v0.3.1 StableFoundation ComponentReact 18 & 19Zero Runtime CSS

Accordion

Grouped disclosures with single or multiple expansion.

Interactive preview

Can I customize the source?

Yes. Keep the MIT notice and change the implementation to suit your project.

How do themes work?

Override the scoped CSS tokens for your colors, type and spacing.

Future adapters
Not available yet.

Usage

import { Accordion } from "@devvy-ui/react";

<Accordion items={[{value:"ownership", title:"Can I change the source?", content:<p>Yes. Keep the MIT notice and make it yours.</p>}, {value:"themes", title:"Can I change the theme?", content:<p>Override the design tokens.</p>}]} />

API reference

Native HTML attributes, className, style and a forwarded ref are supported. Component-specific props:

PropTypeDefaultDescription
itemsreadonly AccordionItem[]requiredUnique value, title, content and optional disabled.
value / defaultValuereadonly string[][]Controlled or initial expanded values.
onValueChange(values: string[]) => void—Reports requested expansion.
multiplebooleanfalseAllow multiple open items.

Accessibility & behavior

Platform Behavior & Guidelines

Native details/summary provide Tab, Enter and Space behavior and hide closed content from focus. Controlled requests wait for caller updates. Disabled summaries remain discoverable but cannot open. Use unique values and meaningful titles; no overlay or focus trap is added.

Source ownership

Run npx @devvy-ui/cli init once in your React project, then add the source:

npx @devvy-ui/cli add accordion

Make the source yours.

Start from the canonical implementation used by the package and registry. Change the code, keep the MIT notice, and build the behavior your project needs.

Accordion.tsxREACT / TSX

Edit your own copy. Downloaded source uses your changes; the component preview above uses the shipped version. Run the source installer first to include shared helpers.