Skip to content

Early previewhamur is not on npm yet. The components are being built in the open, follow along on GitHub.

UIComponentsReact

Accordion

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

accordion.tsx

Installation

npx shadcn@4.23.0 add https://hamur.dev/r/react/accordion.json

It 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

Default

Three sections, the first one open.

Its preview and code are at the top of the page.

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.