ValyroUI Русская версия

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

PropTypeDefault
openbooleanControlled open; use with onOpenChange.
defaultOpenbooleanInitial state when uncontrolled.
onOpenChange(open: boolean) => voidCalled with the new open when it changes.
disabledbooleanThe trigger does nothing.
collapsedHeightnumberHeight 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.
springbooleanUnfold on the smooth spring instead of the theme's curve.
triggerReactNodeThe trigger's text in the props form: a button with a chevron above the content (the children).
childrenReactNodeThe content, or the compound form: Collapsible.Trigger and Collapsible.Content.

Compound parts

Collapsible.Trigger (CollapsibleTrigger), Collapsible.Content (CollapsibleContent), Collapsible.Indicator (CollapsibleIndicator)

Related components

Previous: Tree View · Next: Accordion · All Data and metrics