Skip to content

Collapsible

An interactive component which expands/collapses a panel.

@huin-core starred 3 repositories

@huin-core/primitives

Installation

npm i @huin-core/react-collapsible

API Reference

Collapsible

PropTypeDescription
asChildbooleanWhen set to true, renders the component as its child element, inheriting the child's styles and behavior.
defaultOpenbooleanDetermines whether the component should be open by default when it is initially rendered.
openbooleanControls the open state of the component. When set to true, the component is displayed; when false, it is hidden.
onOpenChangefunctionEvent handler called when the open state of the component changes.
disabledbooleanWhen set to true, disables the component, preventing user interaction or triggering of associated actions.

CollapsibleTrigger

PropTypeDescription
disabledbooleanWhen set to true, disables the component, preventing user interaction or triggering of associated actions.
asChildbooleanWhen set to true, renders the component as its child element, inheriting the child's styles and behavior.

CollapsibleContent

PropTypeDescription
disabledbooleanWhen set to true, disables the component, preventing user interaction or triggering of associated actions.
forceMountbooleanUsed to force mounting when more control is needed. Useful when controlling animation with React animation libraries. It inherits from.

Keyboard Interactions

KeyDescription
Space
Enter
Opens or closes the content.