Layout
Preview
01 Installation
Install
Pull Collapsible from the barrel for everyday use, or the granular path when you want a tighter bundle.
tsxBarrel1 line
import { Collapsible } from "@brika/clay";tsxGranular1 line
import { Collapsible } from "@brika/clay/components/collapsible"; 02 Usage
A minimal example
Drop this into a page. Native HTML attributes pass through to the underlying primitive.
tsxCollapsible.tsx30 lines
'use client';
import { Button } from '@brika/clay/components/button';
import {
Collapsible,
CollapsibleContent,
CollapsibleTrigger,
} from '@brika/clay/components/collapsible';
import { ChevronDownIcon } from 'lucide-react';
/** Basic collapsible, trigger toggles content visibility, no controlled state needed. */
export default function CollapsibleDefaultDemo() {
return (
<Collapsible className="w-full max-w-sm space-y-2">
<CollapsibleTrigger asChild>
<Button variant="outline" className="w-full justify-between">
Show team members
<ChevronDownIcon className="size-4 shrink-0 text-clay-subtle" />
</Button>
</CollapsibleTrigger>
<CollapsibleContent className="rounded-md border border-clay-hairline bg-clay-base p-3 text-clay-default text-sm">
<ul className="space-y-1">
<li>Alice, Engineering</li>
<li>Bob, Design</li>
<li>Carol, Product</li>
</ul>
</CollapsibleContent>
</Collapsible>
);
} 03 Examples
Collapsible, every way
04 Accessibility
Accessibility
- Trigger carries
aria-expandedautomatically, no extra markup needed. - Content carries
aria-hiddenwhen collapsed so AT skips it entirely. - Animate height via CSS
overflow-hidden+ transition, notdisplay:none, to preserve AT semantics.
05 API reference
API reference
Props specific to Collapsible. Native HTML attributes pass through to the underlying primitive, see the component source on GitHub for the full type signature.
<Collapsible />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<CollapsibleContent />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<CollapsibleTrigger />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.