Accordion
Vertically stacked collapsible content sections.
import { Accordion } from "@ninna-ui/navigation"pnpm add @ninna-ui/navigationRequires @ninna-ui/core (auto-installed) + CSS setup.
Usage
Import and use the Accordion component in your application.
import { Accordion } from "@ninna-ui/navigation";
export default function Example() { return ( <Accordion type="single" collapsible> <Accordion.Item value="item-1"> <Accordion.Trigger>Question 1</Accordion.Trigger> <Accordion.Content>Answer 1</Accordion.Content> </Accordion.Item> <Accordion.Item value="item-2"> <Accordion.Trigger>Question 2</Accordion.Trigger> <Accordion.Content>Answer 2</Accordion.Content> </Accordion.Item> </Accordion> );}Basic
A collapsible accordion with single-open behavior.
Variants
Accordion supports outline, soft, and ghost visual styles.
outline
soft
ghost
Multiple Open
Allow multiple items to be expanded simultaneously.
Disabled
Individual accordion items can be disabled.
API Reference
Complete list of props for the Accordion component and its sub-components.
Accordion (Root)
| Prop | Type | Default | Description |
|---|---|---|---|
type* | 'single' | 'multiple' | - | Whether one or many items can be open at once |
variant | 'outline' | 'soft' | 'ghost' | 'outline' | Visual style variant |
value | string | string[] | - | Controlled open item(s) |
defaultValue | string | string[] | - | Default open item(s) (uncontrolled) |
onValueChange | (value: string | string[]) => void | - | Callback when open items change |
collapsible | boolean | false | Allow all items to close (single mode only) |
className | string | - | Additional CSS classes |
Accordion.Item
| Prop | Type | Default | Description |
|---|---|---|---|
value* | string | - | Unique value for this item |
disabled | boolean | false | Whether the item is disabled |
Accordion.Content
| Prop | Type | Default | Description |
|---|---|---|---|
forceMount | true | - | Whether to force mount the content (keeps DOM alive) |
Accessibility
- Follows the
WAI-ARIAAccordion pattern - Arrow keys navigate between triggers
- Home and End keys jump to first/last trigger
- Enter/Space toggles the focused item
- Disabled items are skipped during keyboard navigation
- Triggers use
aria-expandedandaria-controls