videorc/ui

Accordion

Stacked sections that open in place, in a bordered group on the row radius. One open at a time, or several with multiple.

Record at 1080p and 60 fps. Livestreams use the quality each destination accepts.

Installation

$ pnpm dlx shadcn@latest add @videorc/accordion

Usage

import {
  Accordion,
  AccordionContent,
  AccordionItem,
  AccordionTrigger,
} from "@/components/ui/accordion";
<Accordion defaultValue={["video"]}>
  <AccordionItem value="video">
    <AccordionTrigger>Video</AccordionTrigger>
    <AccordionContent>Record at 1080p and 60 fps.</AccordionContent>
  </AccordionItem>
</Accordion>

Anatomy

<Accordion>
  <AccordionItem>
    <AccordionTrigger />
    <AccordionContent />
  </AccordionItem>
</Accordion>

Examples

Multiple

Set multiple to let several items stay open, as the Go Live details for each destination do. The value is always an array, open or closed, single or multiple.

Public, not made for kids. Title: Launch day.

Category: Science & Technology. Title: Launch day.

Theming

Token or attributeMeaning
rounded-row, borderThe group: the 8 px row radius and one hairline
data-openOn an open item, which takes a bg-muted/50 wash
data-panel-openOn the trigger of an open item; swaps the chevron
--accordion-panel-heightThe panel's measured height, eased in 150 ms with data-starting-style and data-ending-style
data-disabledOn a disabled item and its trigger

Keyboard

KeyAction
TabMoves to the next trigger
Enter SpaceOpens or closes the focused item

Accessibility

Each trigger is a button inside a heading, with aria-expanded and aria-controls pointing at its panel. Name the group when it has a job of its own (aria-label="Details for each destination").

API reference

Accordion

Every Base UI Accordion Root prop. The ones that differ from Radix:

Prop

Type

AccordionItem takes a value; AccordionTrigger and AccordionContent take every Base UI Trigger and Panel prop, and AccordionContent's className styles its inner padding box.