UIComponentsReact
A section that a button shows and hides.
Built on the headless Collapsible.See its API in Docs
Rendered by React 19.3.1
Installation
npx shadcn@4.23.0 add https://hamur.dev/r/react/collapsible.jsonIt 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.
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.