Components
Collapsible
A lightweight disclosure primitive for revealing supporting content inline without leaving the current screen.
Loading...
Installation
Install the registry item directly, then add any package dependencies if you are setting the component up manually.
1
Install the component
Run the registry command below to add collapsible to your project.
watermelon add collapsible2
Import the component
Import Collapsible from your local UI registry output.
Import
import { Collapsible } from "@/components/ui/collapsible";Import
Import
import {
Collapsible,
CollapsibleContent,
CollapsibleTrigger,
} from "@/components/ui/collapsible";Usage
Use Collapsible when the user should stay on the same surface while revealing optional context.
Loading...
API Reference
| prop | type | default | description |
|---|---|---|---|
| defaultOpen | boolean | false | Sets the initial open state for uncontrolled usage. |
| open | boolean | - | Controls the collapsible state externally. |
| onOpenChange | (open: boolean) => void | - | Called whenever the open state changes. |
| asChild | boolean | false | Lets the trigger forward press handling into an existing child component. |