Clinia UI

Accordion

Stacks sections under headings that open on demand, for long content read in parts.

shadcn docs →

When to use

  • Long content read in parts, where users open only the sections they need: FAQs, reference notes, grouped settings.
  • A page that would be too long with every section open.

When not to use

  • One section that shows and hides: use Collapsible.
  • Views of the same subject that users switch between: use Tabs.
  • Content everyone must read, such as a consent notice: keep it open on the page, in a Card.

Install

npx shadcn@latest add @clinia/accordion

A design system built on Tailwind v4 and Base UI, encoding Clinia's brand guidelines into reusable components.

Anatomy

Records stay in the region you picked when you created the workspace.
  1. 1Containerdata-slot="accordion"border · rounded-lg
  2. 2Trigger[data-part=trigger-text]text-sm · font-medium
  3. 3Chevron[data-slot=accordion-trigger] > svg:not(.hidden)size-4 · text-muted-foreground
  4. 4Paneldata-slot="accordion-content"text-sm · px-4 pb-4

Clinia rules

  • Trigger text is text-sm font-medium, sentence case, and names the question or topic a reader scans for: How do I rotate an API key?, not More.
  • An open item's chevron points up. The chevron carries the state, with no tint behind the item.
  • One item opens at a time. Set multiple when users need to compare sections side by side.
  • Don't nest an accordion inside another. Split the content into two accordions under their own headings.

Do and don't

Do write each trigger as the question a reader scans for.

Don't use vague triggers that say nothing about what's inside.

States

closed

open

Synced every night at 2 a.m.
hover

focus

disabled

Focus cells apply the component's focus-visible classes statically. Toggle the site theme to review both themes.

Accessibility

Built in

  • Each trigger is a button inside an h3, with aria-expanded and aria-controls pointing at its panel.
  • Enter or Space toggles the focused trigger. Tab moves from one trigger to the next.

Your responsibility

  • Keep the trigger text short and specific: screen reader users jump between the headings to find a section.
  • Set hiddenUntilFound on AccordionContent for reference content, so the browser's find-in-page reaches text in closed panels.
  • Never put the only copy of a required step or a warning in a closed panel.

How to test

  1. Press Tab until a trigger has focus, then Tab again: focus moves to the next trigger.
  2. Press Enter, then Space: the panel opens, then closes, and the chevron flips each time.
  3. With a screen reader, a trigger is announced as its text, a button, and collapsed or expanded, inside a level 3 heading.

API

Every prop comes from Base UI Accordion.