Layout

Accordion

A vertically stacked set of interactive headings that each reveal a section of content.

Preview
01 Installation

Install

Pull Accordion from the barrel for everyday use, or the granular path when you want a tighter bundle.

tsxBarrel1 line
import { Accordion } from "@brika/clay";
tsxGranular1 line
import { Accordion } from "@brika/clay/components/accordion";
02 Usage

A minimal example

Drop this into a page. Native HTML attributes pass through to the underlying primitive.

tsxAccordion.tsx36 lines
'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>
  );
}
03 Examples

Accordion, every way

Controlled

Controlled accordion, manage open state externally with `value` and `onValueChange`.

Disabled

Disabled item, set `disabled` on `AccordionItem` to prevent interaction.

Multiple

Multiple open sections at once, pass `type="multiple"` to the root.

04 Accessibility

Accessibility

  • Triggers carry aria-expanded and aria-controls, no extra markup needed.
  • Content panels are hidden from AT via aria-hidden when collapsed.
  • type="single" collapsible lets the open item be closed; omit collapsible to always keep one open.
  • Arrow keys and Home/End navigate between triggers when focus is inside the accordion.
05 Tokens 6 theme-overridable

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
ColorFill, border, and text colors.1
  • --accordion-chevron-colorcolorvar(--muted-foreground)
    components.accordion.chevronColor

    Color of the chevron icon at the right of an accordion trigger. Rotates 180° when the item is open.

GeometrySizes, lengths, and corner radii.3
  • --accordion-radiusradiusvar(--radius-control)
    components.accordion.radius

    Accordion trigger corner radius.

  • --accordion-padding-xsizecalc(var(--spacing) * 4)
    components.accordion.paddingX

    Inline padding inside the accordion.

  • --accordion-padding-ysizecalc(var(--spacing) * 2)
    components.accordion.paddingY

    Block padding inside the accordion.

MotionAnimation duration and easing.2
  • --accordion-durationdurationvar(--motion-standard-duration)
    components.accordion.duration

    Transition duration for accordion state changes.

  • --accordion-easingeasingvar(--motion-standard-easing)
    components.accordion.easing

    Transition 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.

jsonmy-theme.json12 lines
{
  "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.

06 API reference

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 />

passthrough

No wrapper-specific props, all attributes pass through to the underlying primitive.

<AccordionContent />

passthrough

No wrapper-specific props, all attributes pass through to the underlying primitive.

<AccordionItem />

passthrough

No wrapper-specific props, all attributes pass through to the underlying primitive.

<AccordionTrigger />

passthrough

No wrapper-specific props, all attributes pass through to the underlying primitive.