Collapsible
A disclosure region that expands with an interruptible spring height and a soft blur, wired with the right ARIA attributes.
Customize
Installation
npx shadcn@latest add @kinetic/collapsibleUsage
Wrap a CollapsibleTrigger and a CollapsibleContent in Collapsible.
import {
Collapsible,
CollapsibleContent,
CollapsibleTrigger,
} from "@/components/kinetic/ui/collapsible";
export function Details() {
return (
<Collapsible>
<CollapsibleTrigger>Show details</CollapsibleTrigger>
<CollapsibleContent>Extra information goes here.</CollapsibleContent>
</Collapsible>
);
}Controlled state
Use open with onOpenChange, or defaultOpen to start expanded.
const [open, setOpen] = useState(true);
<Collapsible open={open} onOpenChange={setOpen}>...</Collapsible>Custom trigger
Set asChild on CollapsibleTrigger to pass the toggle and ARIA props to your own button.
<CollapsibleTrigger asChild>
<Button variant="ghost" size="icon-sm" aria-label="Toggle">
<ChevronsUpDownIcon />
</Button>
</CollapsibleTrigger>Keep mounted
By default the content unmounts when closed. Set keepMounted on Collapsible (or forceMount on the content) to keep it in the DOM with the hidden attribute. Use disabled to lock the toggle.
<Collapsible keepMounted>...</Collapsible>Motion preferences
Use blurPx and speed to tune the reveal. Reduced motion expands and collapses instantly.
API Reference
Collapsible
Zero-dependency disclosure root managing open state, spring height physics, blur-fade intensity, and keepMounted behavior.
| Prop | Type | Default | Description |
|---|---|---|---|
open / defaultOpen / onOpenChange | boolean / (open: boolean) => void | - | Controlled or uncontrolled expanded state. |
blurPx / speed | number | 4 / 1 | Soft blur radius during reveal/collapse (0-16 px) and spring speed multiplier (0.25-4). |
keepMounted / disabled | boolean | false / false | Keeps collapsed children mounted with hidden attribute, or disables toggling. |
CollapsibleTrigger / CollapsibleContent
Zero-dep asChild trigger button with aria-expanded/aria-controls and RAF spring-animated content container.
| Prop | Type | Default | Description |
|---|---|---|---|
asChild (Trigger) / forceMount (Content) | boolean | false | Delegates trigger ARIA props to a child button; forceMount aliases keepMounted on content. |