Rime

Accordion

Stacked sections that open and close in place: one at a time or several, on glass or plain hairlines.

Accordion holds a list of questions, settings groups or details where people read one section at a time. type="single" keeps one section open (collapsible lets the open one close again); type="multiple" lets any number stay open.

Each header is a real heading (headingLevel, default h3) holding a button, so the page outline stays right. The panel animates its height with a grid-row transition, with no measuring, and reduced motion makes it instant. Closed panels are inert, so their links leave the tab order.

appearance="glass" is a frosted panel with hairlines between sections; "plain" is hairlines only, for use inside a Card or GlassPanel that already provides the surface.

Installation

npx shadcn@latest add KezLahd/rime/accordion

Also installs: base, icon.

Usage

import { Accordion } from "@/components/ui";

<Accordion
  defaultValue={["billing"]}
  items={[
    { id: "billing", title: "When is an invoice issued?", content: "On the first working day of each month." },
    { id: "seats", title: "Can I add a team member mid-cycle?", content: "Yes, from the day it is added." },
  ]}
/>

Examples

Single, one open

On the first working day of each month, for the month before. It lists every order by project.

Yes. The new seat is charged from the day it is added, on the next invoice.

Open the project, then choose Export from its menu. You get a CSV of every order and its status.

Multiple open

type="multiple": opening one section leaves the others as they are.

On the first working day of each month, for the month before. It lists every order by project.

Yes. The new seat is charged from the day it is added, on the next invoice.

Open the project, then choose Export from its menu. You get a CSV of every order and its status.

Plain, inside a surface

On the first working day of each month, for the month before. It lists every order by project.

Yes. The new seat is charged from the day it is added, on the next invoice.

Open the project, then choose Export from its menu. You get a CSV of every order and its status.

API

Generated from the component's TypeScript types and JSDoc (scripts/gen-ui-registry.mjs), so it always matches the source.

Accordion

Accordion props
PropTypeDefaultDescription
itemsRequiredReadonlyArray<AccordionItem>
type"single" | "multiple""single"single = one section open at a time. multiple = any number.
valueReadonlyArray<string>Open ids, controlled. Pair with onValueChange.
defaultValueReadonlyArray<string>Open ids on first render, uncontrolled.
onValueChange(value: string[]) => void
collapsiblebooleantruesingle only: false keeps one section open at all times.
headingLevel2 | 3 | 4 | 53Heading level the triggers sit in, to fit the page outline.
appearance"glass" | "plain""glass"glass = a frosted panel with hairlines between sections. plain = hairlines only.
classNamestring

Theme tokens

Per-component tokens are undeclared by default, so the default shown is the fallback the CSS uses. Set one at :root (or in theme.css) to restyle every instance. Live values are read from this page, so they follow the Rime Studio.

Accordion per-component tokens
TokenDefaultLive value
--accordion-pad-xcalc(16px * var(--density))…
--accordion-pad-ycalc(14px * var(--density))…
--accordion-radiusvar(--r-lg)…
--accordion-widthmin(560px, 100%)…

System tokens it reads

Accordion system tokens
TokenDefaultLive value
--blur-panel-lighttokens.css…
--border-wtokens.css…
--densitytokens.css…
--durtokens.css…
--dur-slowtokens.css…
--easetokens.css…
--ease-outtokens.css…
--focus-colortokens.css…
--glass-edgetokens.css…
--glass-fill-nestedtokens.css…
--ink-bodytokens.css…
--ink-brandtokens.css…
--ink-disabledtokens.css…
--ink-headingtokens.css…
--ink-mutedtokens.css…
--linetokens.css…
--line-glasstokens.css…
--r-lgtokens.css…
--shadow-hairline-cardtokens.css…
--shadow-speculartokens.css…
--text-bodytokens.css…
--text-smalltokens.css…
--wash-hovertokens.css…

Accessibility

  • WAI-ARIA accordion: each trigger is a <button> inside a heading, with aria-expanded and aria-controls; each panel is a region labelled by its trigger.
  • Up and Down move focus between headers, Home and End jump to the first and last; Enter and Space toggle.
  • Closed panels are inert, so nothing hidden can take focus.
  • Focus shows as a 2px accent outline inset in the row.

Do and don't

Do

  • Write titles as the question or the name of the group, so a closed list scans.
  • Open the most useful section by default with defaultValue.

Don't

  • Don't hide required form fields in a closed section.
  • Don't nest accordions; use headings and a longer page instead.

For AI agents

This page as markdown, rendered from the same registry entry. Point an agent at it (or add .md to this page's URL), or at /llms.txt for the index.

Open accordion.md

Related: collapsible, card