Accordion
Pass items as { value, title, content }. The Zag.js machine manages focus,
keyboard navigation, and open panels.
import { Accordion } from '@manti-ui/react'; const items = [ { value: 'shape', title: 'How small should they be?', content: 'Traditionally tiny — a good cook fits many on a single spoon.', }, { value: 'serve', title: 'What goes on top?', content: 'Garlic yogurt, melted chili butter, dried mint, and sumac.', }, { value: 'freeze', title: 'Can I freeze them?', content: 'Yes — freeze raw on a tray, then bag once solid.', }, ]; export default function AccordionBasic() { return ( <div className="w-full max-w-[calc(var(--manti-space-16)*7)]"> <Accordion items={items} defaultValue={['shape']} /> </div> ); }
Multiple panels
Set multiple to keep several panels open. Use defaultValue for the initial
uncontrolled state.
Traditionally tiny — a good cook fits many on a single spoon.
Garlic yogurt, melted chili butter, dried mint, and sumac.
Yes — freeze raw on a tray, then bag once solid.
API
| Prop | Type | Default | Description |
|---|---|---|---|
items | AccordionItem[] | — | The disclosure items. Each is `{ value, title, content, disabled? }`. |
multiple | boolean | false | Allow multiple panels open at once. |
collapsible | boolean | true | Allow closing the open panel in single mode. |
value | string[] | — | Controlled set of open values. |
defaultValue | string[] | — | Initial open values for uncontrolled usage. |
onValueChange | (value: string[]) => void | — | Called whenever the open set changes. |
disabled | boolean | — | Disable the whole accordion. |
Styling
Anatomy
| Part | Selector | Description |
|---|---|---|
root | [data-scope="accordion"][data-part="root"] | The stack wrapping every disclosure item. |
item | [data-scope="accordion"][data-part="item"] | A single disclosure (trigger plus content). |
item-trigger | [data-scope="accordion"][data-part="item-trigger"] | The header button that toggles the panel. |
item-indicator | [data-scope="accordion"][data-part="item-indicator"] | The chevron that rotates with the open state. |
item-content | [data-scope="accordion"][data-part="item-content"] | The collapsible region revealed when the item is open. |
Tokens
| Token | Controls |
|---|---|
--manti-accordion-radius | radius |
--manti-accordion-padding-x | padding x |
--manti-accordion-padding-y | padding y |
--manti-accordion-gap | gap |
Last updated