Collapse
@rockshin/tao-uiItem-based panels with built-in headers, expand icons and content regions; supports independent panels and accordions.
When to use
Group settings, explanations and secondary details. Use accordion to keep one panel open at a time. Make required information easy to discover.
Examples
Basic panels
Pass items for complete panels. Multiple panels can be expanded by default.
Accordion
Open one panel at a time. Clicking the active panel again closes it.
Controlled expansion
Coordinate expansion through activeKey and onChange. Callbacks always receive an array of string keys.
Three sizes
Choose small, medium or large; size also inherits from TaoProvider.
Borderless and ghost
bordered={false} removes the outer border; ghost also removes the background and separators.
Trigger modes and disabled panels
Toggle with the whole header, only the icon, or disable a panel. Arrow-free headers remain clickable.
Extra actions and end icon
Put independent actions in extra. Clicking them does not toggle the panel.
Nested panels and custom icons
Nested groups keep independent state. Custom icons receive isActive.
Retain or destroy content
Bodies mount on first expansion and retain inputs when closed. destroyOnHidden unmounts closed bodies; an item with forceRender stays mounted.
Panels on a phone
Long titles wrap while icons and extra actions stay usable. Phone and desktop selection follows the shared preview state.
Migration and composition
Rename Collapsible / @rockshin/tao-ui/collapsible to Collapse / @rockshin/tao-ui/collapse. Prefer items over hand-built headers and bodies. Collapse.Trigger / Collapse.Content remain available for custom single disclosures with open / onOpenChange; item panels use activeKey / onChange. Do not mix the two state APIs.