Collapsible reveals one independent panel when controlled state, shared anatomy, or maintained motion adds value beyond native disclosure.
Overview and decision boundary
Use Collapsible for one independent disclosure when controlled state, shared anatomy, or maintained motion adds durable value.
Do not replace native details and summary when no shared state, motion, or anatomy is needed.
1import{ChevronDown}from"@nerio-ui/adapters/icons";2import{Icon}from"@nerio-ui/ui";3import{Collapsible,CollapsiblePanel,CollapsibleTrigger}from"@nerio-ui/ui/client";45<Collapsible>6<CollapsibleTrigger>7Recovery keys8<Iconaria-hiddenicon={ChevronDown}/>9</CollapsibleTrigger>10<CollapsiblePanel>11Generate a new set before revoking the current recovery keys.12</CollapsiblePanel>13</Collapsible>
Installation and imports
Install the editable registry source, or use the matching package entrypoint when the product keeps Nerio as a workspace dependency.
1import{Collapsible,CollapsiblePanel,CollapsibleTrigger}from"@nerio-ui/ui/client";23<Collapsible>4<CollapsibleTrigger>Recovery keys</CollapsibleTrigger>5<CollapsiblePanel>Generate and store recovery keys securely.</CollapsiblePanel>6</Collapsible>
Variants
Path
Use
Collapsible
One controlled or uncontrolled disclosure with maintained anatomy and motion.
details / summary
Simple native disclosure with no shared abstraction requirement.
Anatomy
Slot
Purpose
root
Owns one open state and the disabled boundary.
trigger
Native button associated with the panel.
panel
Hidden content that unmounts when closed by default.
States
State
Behavior
Closed
Panel is removed by default, including interactive descendants.
Open
Measured height and opacity reveal the complete content.
Disabled
The visible trigger cannot change state.
Reduced motion
The panel changes state immediately without travel.
Motion
Panel height uses the Base UI measured height variable and shared reveal tokens.
Opacity reinforces state without carrying essential information.
Reduced motion makes the state change immediate.
Accessibility
Uses the Base UI Collapsible primitive with a native type=button trigger by default.
The trigger owns aria-expanded and aria-controls while the panel owns the corresponding stable ID.
Closed panels are unmounted by default so hidden interactive descendants do not remain focusable; keepMounted and hiddenUntilFound preserve browser-hidden semantics.
Supports one controlled or uncontrolled open state and a disabled root without duplicating Base UI state.
Enter, Space, pointer, and touch activation toggle the panel while focus remains on the trigger.
Height and opacity motion use shared disclosure tokens and become immediate under reduced motion.
Use native details and summary when controlled state, maintained motion, or shared anatomy adds no durable value.
Review the shared responsibility and evidence boundaries in the Accessibility foundation alongside this component-specific contract. Use the Spacing & layout foundation for shared density, wrapping, overflow, reflow, and component-versus-product ownership guidance. The Color foundation, Typography foundation, and Localization foundation define the shared visual-role, text-resilience, direction, and locale boundaries used by component examples.
API
Prop
Use
open / defaultOpen
Controlled or uncontrolled open state.
onOpenChange
Receives the next state and cancellable Nerio event details.
disabled
Disables the complete disclosure.
keepMounted / hiddenUntilFound
Preserves browser-hidden content for state or page search.
Implementation contract
Contract
Value
Registry item
collapsible installs 6 source files into the configured components directory.