Accordion
Rooms are ready from 15:00.
Yes, behind the building.
Dogs stay on the ground floor.
npx shadcn add @klarhimmel/accordionCopy for AIExamples
Faq
Multiple
Controlled
DetailsAbout, usage, props and more
A stack of headings that each open and close a panel. One open at a time, or several.
When to use
Use for
A list of questions or settings groups where people read a few and skip the rest.
Not for
Content everyone must read. Show it. Not for switching views. Use Tabs.
Pairs with
Text, Badge, Card.
Preview
Rooms are ready from 15:00. If you arrive earlier we keep your bags at the desk.
Yes, twelve spaces behind the building. They are free for guests and cannot be booked in advance.
Dogs stay in the ground-floor rooms for a small cleaning fee. Ask us when you book.
Free until 48 hours before arrival. After that the first night is charged.
Import
Import
- Files
- accordion.tsx, in components/klarhimmel/ui/. With it: theme, utils. npm: lucide-react.
- Render in
- Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
Accordion.type | 'single' | - | One panel open at a time, or any number. |
Accordion.value | string | - | Open item value (a string when single, a list when multiple). |
Accordion.defaultValue | string | - | Open item value (a string when single, a list when multiple). |
Accordion.onValueChange | (value: string) => void | - | Open item value (a string when single, a list when multiple). |
Accordion.collapsible | boolean | - | Single mode only. With false the open item cannot be closed. |
Accordion.children | ReactNode | required | |
Accordion.className | string | - | Extra classes, merged after the component's own. |
AccordionItem.value | string | required | Open item value (a string when single, a list when multiple). |
AccordionItem.title | ReactNode | required | |
AccordionItem.level | 2 | 3 | 4 | 5 | 3 | |
AccordionItem.disabled | boolean | - | |
AccordionItem.children | ReactNode | required |
Accessibility
| Key | Does |
|---|---|
Enter / Space | Opens or closes the focused panel |
Down / Up | Moves focus to the next or previous heading, wrapping |
Home / End | Moves focus to the first or last heading |
Tab | Moves on; closed panels are skipped |
Each trigger sits in a heading. Choose its level so the page outline stays correct.
Accessibility