Accordion
display
Accordion: a group of collapsible sections
Terminal
$termuijs render accordion
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
| Prop | Type | Required | Description |
|---|---|---|---|
sections | AccordionSection[] | required | — |
multiple | boolean | optional | Allow multiple sections open at once |
openIndex | number | optional | Index of the initially open section |
expandChar | string | optional | Expand indicator char |
collapseChar | string | optional | Collapse indicator char |
onToggle | (index: number, open: boolean) => void | optional | Callback fired when a section is toggled |