Accordion
A vertically stacked set of interactive headings that each reveal a section of content.
Install
Pull Accordion from the barrel for everyday use, or the granular path when you want a tighter bundle.
import { Accordion } from "@brika/clay";import { Accordion } from "@brika/clay/components/accordion";A minimal example
Drop this into a page. Native HTML attributes pass through to the underlying primitive.
'use client';
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from '@brika/clay/components/accordion';
/** Single-select FAQ accordion, one item open at a time, collapsible. */
export default function AccordionDefaultDemo() {
return (
<Accordion type="single" collapsible className="w-full max-w-sm">
<AccordionItem value="item-1">
<AccordionTrigger>What is a design system?</AccordionTrigger>
<AccordionContent>
A design system is a collection of reusable components, guidelines, and tokens that
teams use to build consistent interfaces across products.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>Is Clay accessible?</AccordionTrigger>
<AccordionContent>
Yes. Every component is built on Radix UI primitives, which handle ARIA roles,
keyboard navigation, and focus management.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-3">
<AccordionTrigger>Can I use custom themes?</AccordionTrigger>
<AccordionContent>
Yes. The token system lets you override any CSS variable at the theme level without
touching component source code.
</AccordionContent>
</AccordionItem>
</Accordion>
);
}Accordion, every way
Accessibility
- Triggers carry
aria-expandedandaria-controls, no extra markup needed. - Content panels are hidden from AT via
aria-hiddenwhen collapsed. -
type="single" collapsiblelets the open item be closed; omitcollapsibleto always keep one open. - Arrow keys and Home/End navigate between triggers when focus is inside the accordion.
Theme tokens
Every CSS variable Accordion reads, with its default and the
dotted path you'd write in a ThemeConfig JSON
to override it. Set any of these in your theme to retune Accordion
without touching component code.
Accordion tokens
6 tokens--accordion-chevron-colorcolorvar(--muted-foreground)components.accordion.chevronColorColor of the chevron icon at the right of an accordion trigger. Rotates 180° when the item is open.
--accordion-radiusradiusvar(--radius-control)components.accordion.radiusAccordion trigger corner radius.
--accordion-padding-xsizecalc(var(--spacing) * 4)components.accordion.paddingXInline padding inside the accordion.
--accordion-padding-ysizecalc(var(--spacing) * 2)components.accordion.paddingYBlock padding inside the accordion.
--accordion-durationdurationvar(--motion-standard-duration)components.accordion.durationTransition duration for accordion state changes.
--accordion-easingeasingvar(--motion-standard-easing)components.accordion.easingTransition easing for accordion state changes.
Override in a theme
Authoring a theme is plain JSON. Drop overrides under
components.accordion, the names
are camelCase versions of the variable suffix.
{
"id": "my-theme",
"name": "My Theme",
"description": "...",
"accentSwatches": ["#000"],
"components": {
"accordion": {
"paddingX": "calc(var(--spacing) * 4)"
}
}
}
Then apply with applyTheme(myTheme)
(see the theming guide),
scope it to a subtree with themeToCssVars(myTheme, mode),
or consume any token directly in your own JSX with the matching Tailwind utility
(e.g. bg-accordion-…) — see the
chips on each token row.
API reference
Props specific to Accordion. Native HTML attributes pass through to the underlying primitive, see the component source on GitHub for the full type signature.
<Accordion />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<AccordionContent />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<AccordionItem />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<AccordionTrigger />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.