- Accordion
- Action Bar
- Alert Dialog
- Alert
- Announcement
- Aspect Ratio
- Autocomplete
- Avatar
- Badge
- Bottom Navigation
- Breadcrumb
- Button Group
- Button
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Circular Progress
- Circular Slider
- Clipboard
- Collapsible
- Color Picker
- Combobox
- Command
- Context Menu
- Data List
- Date Picker
- Dialog
- Drawer
- Editable
- Field
- File Upload
- Float
- Floating Panel
- Frame
- Hint
- Hover Card
- Image Cropper
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Link Overlay
- Listbox
- Marquee
- Menu
- Native Select
- Number Input
- Pagination
- Popover
- Progress
- Prose
- QR Code
- Radio Group
- Rating
- Resizable
- Scroll Area
- Segment Group
- Select
- Separator
- Sheet
- Sidebar
- Signature Pad
- Skeleton
- Skip Nav
- Slider
- Spinner
- Status
- Steps
- Switch
- Table
- Tabs
- Textarea
- Timer
- Toast
- Toggle Group
- Toggle Tooltip
- Toggle
- Tooltip
- Tour
- Tree View
Installation
pnpm dlx shadcn@latest add https://shark.vini.one/r/collapsible.json
Usage
import { Collapsible, CollapsibleTrigger, CollapsibleContent } from "@/components/ui/collapsible";
<Collapsible> <CollapsibleTrigger>Open Collapsible</CollapsibleTrigger> <CollapsibleContent>Collapsible Content</CollapsibleContent> </Collapsible>
Controlled
Use the open and onOpenChange props to control the collapsible state programmatically.
❌
State
Disabled
Use the disabled prop on the collapsible to disable it.
Examples
Nested
Collapsibles can be nested to create hierarchical structures.
Partial Collapse
Use the collapsedHeight prop to show a portion of the content when collapsed.
This is the first paragraph of content. When collapsed, only a portion of this content will be visible.
This is the second paragraph. It will be hidden when the collapsible is in its collapsed state.
This is the third paragraph. Expand the collapsible to see all the content.
This is the fourth paragraph. The collapsedHeight prop controls how much content is visible when collapsed.
Interactive elements (links, buttons, inputs) within the collapsed area automatically become inaccesible to prevent keyboard navigation to hidden content.
API Reference
Collapsible
Root component. Controls expand/collapse state and animation.
| Prop | Type | Default |
|---|---|---|
open | boolean | - |
defaultOpen | boolean | false |
onOpenChange | ({ open }: OpenChangeDetails) => void | - |
collapsedHeight | string | - |
className | string | - |
CollapsibleTrigger
Toggles expand/collapse on click. Use asChild for custom trigger elements.
| Prop | Type | Default |
|---|---|---|
className | string | - |
asChild | boolean | false |
CollapsibleContent
Holds the content that expands and collapses. Animated by default.
| Prop | Type | Default |
|---|---|---|
className | string | - |
asChild | boolean | false |
CollapsibleIndicator
Chevron or icon that rotates to indicate open/closed state.
| Prop | Type | Default |
|---|---|---|
className | string | - |
asChild | boolean | false |
For a complete list of props, see the Ark UI documentation.