Skip to content

Accordion

widgetsdisplay

Accordion: a group of collapsible sections

Installation

$ bunx termuijs add accordion

Copies the source into src/components/accordion/ and installs @termuijs/core, @termuijs/widgets.

Usage

ts
import { Accordion } from '@termuijs/widgets'
ts
new Accordion(sections: AccordionSection[], style: Partial<Style> = {}, opts: AccordionOptions = {},)

API Reference

Accordion

PropTypeRequiredDescription
sectionsAccordionSection[]required
multiplebooleanoptionalAllow multiple sections open at once
openIndexnumberoptionalIndex of the initially open section
expandCharstringoptionalExpand indicator char
collapseCharstringoptionalCollapse indicator char
onToggle(index: number, open: boolean) => voidoptionalCallback fired when a section is toggled
#display#accordion