Accordion
A vertically stacked set of interactive headings that each reveal a section of content.
Installation
Install the Alert component using the nocta-ui CLI:
npx nocta-ui add accordion
Then import the components you need:
import {
Accordion,
AccordionItem,
AccordionTrigger,
AccordionContent
} from './accordion';
Examples
Basic
A simple accordion with collapsible content sections.
Card Variant
Use the card variant for a more elevated appearance with individual cards for each item.
Sizes
The accordion comes in three sizes: sm
, md
(default), and lg
.
API Reference
Accordion
Prop | Type | Default | Description |
---|---|---|---|
variant | 'default' | 'card' | 'default' | Visual variant |
size | 'sm' | 'md' | 'lg' | 'md' | Size of the accordion |
className | string | '' | Additional CSS classes |
AccordionItem
Prop | Type | Default | Description |
---|---|---|---|
value | string | undefined | Optional id seed for ARIA linking |
id | string | undefined | Optional explicit id seed |
disabled | boolean | false | Disables the item |
defaultOpen | boolean | false | Whether the item should be open by default |
className | string | '' | Additional CSS classes |
AccordionTrigger
Prop | Type | Default | Description |
---|---|---|---|
className | string | '' | Additional CSS classes |
AccordionContent
Prop | Type | Default | Description |
---|---|---|---|
className | string | '' | Additional CSS classes |