ComponentsLayout
Accordion
Stacked sections that expand and collapse. Good for FAQs.
Stacked sections that expand and collapse. Good for FAQs.
<Accordion type="single" collapsible>
<AccordionItem value="free">
<AccordionTrigger>Is Junco free?</AccordionTrigger>
<AccordionContent>Yes. Everything is MIT licensed.</AccordionContent>
</AccordionItem>
<AccordionItem value="react">
<AccordionTrigger>Can I use it without React?</AccordionTrigger>
<AccordionContent>Yes. The semantic classes are plain CSS.</AccordionContent>
</AccordionItem>
</Accordion>The same component at all four levels. Pick the one that fits your project; they share tokens, so they mix.
npm i junco @junco/tailwindimport { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from "junco";
<Accordion type="single" collapsible>
<AccordionItem value="free">
<AccordionTrigger>Is it free?</AccordionTrigger>
<AccordionContent>Yes, MIT licensed.</AccordionContent>
</AccordionItem>
</Accordion>Each item is its own bordered card. Good for settings groups.
Accordion#typecollapsiblevariantvalue / defaultValueonValueChange| Prop | Type | Default |
|---|---|---|
typeRequired. single opens one item at a time; multiple lets several stay open. | "single" | "multiple" | – |
collapsibleWith type single, lets the open item close again. | boolean | false |
variantHairline rows, or separate bordered cards. | "line" | "card" | "line" |
value / defaultValueOpen item(s); an array with type multiple. | string | string[] | – |
onValueChangeCalled when items open or close. | (value) => void | – |
AccordionItem#valuedisabled| Prop | Type | Default |
|---|---|---|
valueRequired. Identifies the item. | string | – |
disabledCan't be opened or closed. | boolean | – |
AccordionTrigger#headingLevelclassNames| Prop | Type | Default |
|---|---|---|
headingLevelHeading level wrapping the trigger, for a correct document outline. | 2 | 3 | 4 | 5 | 6 | 3 |
classNamesClass overrides for the heading and chevron. | { heading?, icon? } | – |
| Key | Action |
|---|---|
| Enter | Opens or closes the focused section. |
| Space | Same as Enter. |
| ↓↑ | Moves between section headers. |
| HomeEnd | Jumps to the first or last header. |