Skip to content

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

UIComponentsReact

Collapsible

A section that a button shows and hides.

Built on the headless Collapsible.See its API in Docs

Rendered by React 19.3.1

collapsible.tsx

Installation

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

It also adds utils. The app needs its setup first: Installation.

Usage

Collapsible holds CollapsibleTrigger and CollapsibleContent. Control it with open and its change event, or leave it to defaultOpen. It has no classes of its own: style the trigger, often by rendering it as a Button, and the content. Open state and the button's aria-expanded come from the headless Collapsible.

import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible'

Examples

Default

One repository shown, two more behind an icon button.

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 Collapsible's API reference.