Collapsible
Collapsible controls one expandable section, such as a disclosure, show-more block, or sidebar group.
Purpose
Collapsible controls one expandable section such as a disclosure, show-more block, or sidebar group. Use Accordion for a related collection of panels.
Basic usage
Installation
With the Siteplane registry alias configured, add the component and import the installed source from your app.
CLI
pnpm dlx shadcn@4.16.1 add @siteplane/collapsibleImport
import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from "@/components/ui/collapsible";Need the machine-readable source metadata? View registry JSON.
Usage
Collapsible is for a single disclosure area. Use Accordion when multiple related panels belong together.
import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from "@/components/ui/collapsible";
import { Button } from "@/components/ui/button";
export function Example() {
return (
<Collapsible defaultOpen>
<CollapsibleTrigger render={<Button variant="outline" />}>Details</CollapsibleTrigger>
<CollapsiblePanel>Deployment checks passed.</CollapsiblePanel>
</Collapsible>
);
}Examples
Chevron rotation, the disabled state and trigger placement are props and compositions of the same primitive.
Chevron rotation
Any trigger child marked data-slot="collapsible-chevron" rotates while the panel is open. No per-trigger wiring needed.
Disabled
Show more
The trigger stays anchored while the additional text expands below it.
Filter group
API Reference
The reference lists the source-owned exports and props that are easy to miss in visual examples. Inherited Base UI props remain available unless the wrapper narrows them.
- Use
defaultOpenfor uncontrolled initial state. - Use
openwithonOpenChangewhen another control or application state owns the disclosure state. - Set
disabledonCollapsibleto disable the trigger and state together. CollapsiblePanel hiddenUntilFoundkeeps collapsed content available to browser find-in-page and lets the browser reveal a matching panel.- Keep trigger and panel inside the same root.
Motion
Component motion uses the shared Siteplane motion contract. See the global motion guide for provider setup, tokens and reduced-motion behavior.
- Panel height uses
--collapsible-panel-heightwith native starting and ending styles. - Keep the preview or product composition top-anchored so opening expands downward instead of recentering the entire control.
- Chevron rotation and pointer states are additive composition behavior; do not nest a second height or opacity animation around the panel.
- System and provider reduced-motion modes remove panel and chevron transition interpolation through the primitive and global contract.
Accessibility
- Give every trigger visible text or an accessible label.
- Keep trigger and panel connected through the Base UI context.
- Disabled state remains recognizable and cannot activate the panel.
- Use
hiddenUntilFoundwhen collapsed documentation must remain searchable.
Implementation Guidance
- Do not create toggle divs in place of
CollapsibleTriggerandCollapsiblePanel. - Keep one state owner; do not mix controlled and uncontrolled props.
- Avoid nested layout animations around the native panel transition.