← Back to all components
Accordion
Accessible Accordion component with macOS-inspired styling, interactive states, and smooth transitions. Supports default, expanded, hover, focus, and disabled states.
Accordion Demo
Default
This Accordion is tokenized via CSS variables so you can map exact Figma values (spacing, radius, color, motion). Override any --acc-* variable at a wrapper level.
Height transitions use a JS-assisted auto-height pattern: we set an explicit pixel height then revert to auto after the transition ends for natural intrinsic growth.
Yes. Pass
chevronPosition="start" for leading disclosure icon. You can also replace the Chevron by wrapping the label and injecting a custom icon.You should not see this open; disabled prevents interaction & focus.
Figma Token Overrides
Copy the pixel values from your Figma frame into these custom properties. This keeps Tailwind utility ergonomics while allowing precise visual parity.
Adjust
--acc-duration and --acc-ease to match motion curves defined in your design system (e.g., standard / expressive).Provide dark variants like
--acc-bg-dark, --acc-bg-open-dark, --acc-fg-dark, and --acc-panel-fg-dark at a parent wrapper for theme switching.Figma Variants Table
Accordion
State: :hover
State: Closed
State: Open
Size: Large
ACCORDION NAME
ACCORDION NAME
ACCORDION NAME
Size: Small
ACCORDION NAME
ACCORDION NAME
ACCORDION NAME
Usage (React)
Basic multi-item usage with default styling.
import Accordion from '@/components/design-system/Accordion/Accordion';
export function Example() {
return (
<Accordion>
<Accordion.Item label=\"Section A\" defaultOpen>Content A</Accordion.Item>
<Accordion.Item label=\"Section B\">Content B</Accordion.Item>
<Accordion.Item label=\"Section C\" disabled>Disabled Content</Accordion.Item>
</Accordion>
);
}Figma Token Overrides
Override any visual value by setting CSS variables on the root Accordion element:
<Accordion
style={{
'--acc-radius': '12px',
'--acc-trigger-px': '18px',
'--acc-trigger-py': '14px',
'--acc-panel-px': '18px',
'--acc-font-size': '15px',
'--acc-line-height': '22px',
'--acc-bg': '#F9F9FB',
'--acc-bg-open': '#F0F0F3',
'--acc-border': '#D4D4D8',
'--acc-border-hover': '#B4B4B9',
'--acc-fg': '#111113',
'--acc-panel-fg': '#3C3C43',
'--acc-duration': '240ms'
}}
>
<Accordion.Item label=\"Specs\">Token aligned content</Accordion.Item>
</Accordion>Available CSS Variables
--acc-radius--acc-gap--acc-trigger-px--acc-trigger-py--acc-panel-px--acc-panel-pt--acc-panel-pb--acc-font-size--acc-panel-font-size--acc-line-height
--acc-bg/--acc-bg-dark--acc-bg-open/--acc-bg-open-dark--acc-border/--acc-border-hover--acc-fg/--acc-fg-dark--acc-panel-fg/--acc-panel-fg-dark--acc-chevron/--acc-chevron-dark--acc-focus--acc-duration--acc-ease--acc-shadow
Props
Accordion Root
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | Content / items |
| single | boolean | false | (Reserved) future single-open enforcement |
| className | string | '' | Extra classes |
| style | CSSProperties | — | Override tokens via --acc-* |
Item Props
| Prop | Type | Default | Description |
|---|---|---|---|
| label | ReactNode | — | Trigger text / node |
| defaultOpen | boolean | false | Initial expanded state |
| disabled | boolean | false | Disable interaction |
| onToggle | (open:boolean)=>void | — | Open state callback |
| chevronPosition | 'start' | 'end' | 'start' | Chevron placement |
| className | string | '' | Extra wrapper classes |
Code
Source
/src/components/design-system/Accordion/Accordion.demo.tsx