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
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:
| Prop | Type | Default | Description |
|---|---|---|---|
| items | readonly AccordionItem[] | required | Unique value, title, content and optional disabled. |
| value / defaultValue | readonly string[] | [] | Controlled or initial expanded values. |
| onValueChange | (values: string[]) => void | — | Reports requested expansion. |
| multiple | boolean | false | Allow 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 accordionMake 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.
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.