Skip to content
ComponentsMarkdown

Accordion

Expand and collapse vertically stacked disclosure sections. Built on Radix Accordion with configurable heading levels and reduced-motion support.

Live example

Twelve steps from 4px to 128px, snapped to a 4px grid.

Props

PropTypeDefaultDescription
Accordion.type"single" | "multiple"—Allow one item open at a time or multiple simultaneously.
Accordion.collapsiblebooleanfalseWhen type="single", allows closing the currently open item.
AccordionTrigger.headingLevel"h1" | "h2" | "h3" | "h4" | "h5" | "h6""h3"Heading element wrapping the full-width trigger button.

Sizes and tokens

Tier / RoleTokenValue
Chevron rotation--duration-162 / --ease-standard180deg over 162ms
Content height--duration-262 / --ease-enter / --ease-exit--radix-accordion-content-height over 262ms
Item divider--border-width-1 / --border1px bottom border

States

Multiple items can stay expanded at the same time.

Closing item A leaves item B open.

Code

import {
  Accordion,
  AccordionContent,
  AccordionItem,
  AccordionTrigger,
} from "@freshgemui/monoplinth";

export function Example() {
  return (
    <Accordion type="single" collapsible defaultValue="item-1">
      <AccordionItem value="item-1">
        <AccordionTrigger headingLevel="h2">
          Spacing scale
        </AccordionTrigger>
        <AccordionContent>
          Twelve steps from 4px to 128px on a 4px grid.
        </AccordionContent>
      </AccordionItem>
    </Accordion>
  );
}

Do and don't

Do: Match headingLevel to the surrounding document outline
Pass headingLevel='h2' or keep the default 'h3' so accordion triggers sit cleanly below the section heading.
Don't: Hide essential instructions inside collapsed items
Do not collapse critical form validation or required reading; keep primary task content visible.

Accessibility

  • Each AccordionTrigger wraps a <button> inside a semantic heading element and exposes aria-expanded.
  • ChevronDown uses strokeWidth={2}, absoluteStrokeWidth, and aria-hidden="true".
  • Under prefers-reduced-motion: reduce, both content height animation and chevron rotation are disabled.

Rationale

Animating height with --radix-accordion-content-height over --duration-262 and rotating the chevron over --duration-162 keeps disclosure motion responsive and strictly bounded to prefers-reduced-motion.