Accordion
Toggle content sections. Keep layouts clean. Focus user attention.
Every teammate you invite takes a seat. New seats are prorated for the days left in the billing period, and seats you remove come back as credit on the next invoice.
Installation
pnpm dlx nachui add accordionAnatomy
Composition
Use the following composition to build an
Accordion:Variants
Single
The
single type allows only one item to be open at a time.Every teammate you invite takes a seat. New seats are prorated for the days left in the billing period, and seats you remove come back as credit on the next invoice.
Multiple
The
multiple type allows multiple items to be open simultaneously.Without default value
You can omit
defaultValue to have the accordion start completely collapsed.API Reference
Accordion
| Prop | Type | Default | Description |
|---|---|---|---|
type | "single" | "multiple" | "single" | Controls whether only one item or multiple items can be open at the same time. |
defaultValue | string | undefined | The initially opened item. |
children | React.ReactNode | — | Should be AccordionItem components. |
className | string | — | Additional classes for the wrapper. |
Accordion.Item
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | Unique identifier for the item. Required. |
children | React.ReactNode | — | Should include AccordionTrigger and AccordionContent. |
isOpen | boolean | Internal | Determines whether the item is open. |
onToggle | () => void | Internal | Function to toggle open/closed state. |
className | string | — | Additional classes for the wrapper. |
Accordion.Trigger
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | — | The title or content of the button. |
isOpen | boolean | Internal | Whether the item is open (controls icon rotation). |
onToggle | () => void | Internal | Click handler for toggling. |
className | string | — | Additional classes for the trigger button. |
Accordion.Content
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | — | Collapsible content. |
isOpen | boolean | Internal | Controls open state and animations. |
className | string | — | Additional classes for the animated content wrapper. |
Found something to improve?
Notice a bug, typo, or missing detail on this page? Help us make the documentation better by opening a GitHub issue.