Skip to main content
Mantı UI logoMantı UIv0.12.1
Studio

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.

API

PropTypeDefaultDescription
itemsAccordionItem[]The disclosure items. Each is `{ value, title, content, disabled? }`.
multiplebooleanfalseAllow multiple panels open at once.
collapsiblebooleantrueAllow closing the open panel in single mode.
valuestring[]Controlled set of open values.
defaultValuestring[]Initial open values for uncontrolled usage.
onValueChange(value: string[]) => voidCalled whenever the open set changes.
disabledbooleanDisable the whole accordion.

Styling

Anatomy

PartSelectorDescription
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

TokenControls
--manti-accordion-radiusradius
--manti-accordion-padding-xpadding x
--manti-accordion-padding-ypadding y
--manti-accordion-gapgap

Last updated

Built end-to-end with Manti UI components and design tokens. Manti UI is a framework-agnostic design system on Zag.js.

GitHub