UIComponentsReact
A stack of headings that each show or hide a section below them.
Built on the headless Accordion.See its API in Docs
Rendered by React 19.3.1
Installation
npx shadcn@4.23.0 add https://hamur.dev/r/react/accordion.jsonIt also adds utils. The app needs its setup first: Installation.
Usage
Accordion holds an AccordionItem per section, each with an AccordionTrigger and an AccordionContent. Give each item a value; the root's defaultValue or value is the list of open items, and multiple lets more than one stay open. The content's height animates as it opens and closes. The keyboard and the heading and region roles come from the headless Accordion.
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from '@/components/ui/accordion'Examples
API reference
The styled parts pass every prop to the headless part they wrap and add classes. The props, data attributes and keyboard are on Accordion's API reference.