Skip to content
MIZU.

Accordion

Height-animated disclosure with a diamond marker that morphs between states.

View .md

Live — this one is real

Usage

tsx
import { Accordion, AccordionItem } from "mizu-ui";

export function Faq() {
  return (
    <Accordion>
      <AccordionItem value="a" title="First question">
        The answer, revealed with a 450ms expo height animation.
      </AccordionItem>
    </Accordion>
  );
}

Source & setup

Add this component to your project with the shadcn CLI. The command copies its source into your configured UI directory, with base.css, Mizu’s tokens, and the stylesheets that hold its rules. Each rule lives in one stylesheet, so components you add together never repeat CSS. In a project without a components.json, run npx shadcn@latest init 0xuser64bit/mizu/preset first: plain init installs shadcn’s theme into your global CSS. Then load the fonts.

sh
npx shadcn@latest add 0xuser64bit/mizu/accordion

Every component imports from its own path, its name in kebab case. To paste the example, replace its mizu-ui import with:

tsx
import { Accordion, AccordionItem } from "@/components/ui/mizu/accordion";

For npm imports, import mizu-ui/styles.css once. Fonts are optional via mizu-ui/fonts.css. Override --mizu-* tokens or use className for local styling. Requires React and Motion. A Client Component: its source starts with “use client”.

Inspect composite/Accordion.tsx

Source is included in the npm package under src/composite/Accordion.tsx.

Open full source ↗

Props

PropTypeDefaultDescription
allowMultiplebooleanfalseAllow several items open at once.
value / defaultValue / onValueChangestring[][]The open items: controlled when value is given, otherwise starting from defaultValue.
level2 | 3 | 4 | 5 | 63Heading level of each item, to fit the page's outline.
AccordionItem valuestring—Item identity.
AccordionItem titlestring—Item heading.

Accessibility

Each title is a heading at the chosen level holding a native button with aria-expanded and aria-controls; the panel is a labelled region.

Motion

450ms expo height animation; the marker rotates 45°→0° and scales down when open.

Works alongside