Collapsible
One section that unfolds, or a "show more" preview. Free, MIT · Data and metrics › Lists and trees
Installation
npx valyro-cli@latest add collapsible
npx shadcn@latest add https://valyro.xyz/r/collapsible.json
npm install valyro-ui
import 'valyro-ui/styles.css';
import { Collapsible } from 'valyro-ui';
Props
| Prop | Type | Default | |
|---|---|---|---|
open | boolean | Controlled open; use with onOpenChange. | |
defaultOpen | boolean | Initial state when uncontrolled. | |
onOpenChange | (open: boolean) => void | Called with the new open when it changes. | |
disabled | boolean | The trigger does nothing. | |
collapsedHeight | number | Height in px shown while closed, with a faded bottom edge ("show more"); 0 hides the content. | |
hidden | 'until-found' | 'unmount' | 'keep' | What closed content does: until-found stays in the DOM, hidden, and the browser's find-in-page opens it; keep stays hidden in the DOM (form state survives); unmount drops it. | |
spring | boolean | Unfold on the smooth spring instead of the theme's curve. | |
trigger | ReactNode | The trigger's text in the props form: a button with a chevron above the content (the children). | |
children | ReactNode | The content, or the compound form: Collapsible.Trigger and Collapsible.Content. |
Compound parts
Collapsible.Trigger (CollapsibleTrigger), Collapsible.Content (CollapsibleContent), Collapsible.Indicator (CollapsibleIndicator)
Related components
- List Block — List with images or icons, descriptions and values
- Description List — Key–value list: stacked, inline or a grid with icons
- Tree View — Tree structures
- Accordion — Collapsible sections
- Sortable — Drag-and-drop sorting
- JSON Viewer — JSON viewer
- Timeline — Event timeline
- Data Table — Tables with search and sorting
- Data Grid — Grid for 100,000 rows: grouping, filters, inline editing
- Virtual List — Virtual list for 100,000 rows
- Bulk Action Bar — Actions for selected rows, with keyboard shortcuts
- Card — All-purpose cards
Previous: Tree View · Next: Accordion · All Data and metrics