The Collapsible component provides an interactive way to show and hide content. It’s useful for creating expandable sections, FAQs, or any interface where content needs to be progressively disclosed.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/mui/base-ui/llms.txt
Use this file to discover all available pages before exploring further.
Import
Basic Usage
Key Features
- Controlled or Uncontrolled: Use
openandonOpenChangefor controlled state, ordefaultOpenfor uncontrolled. - Smooth Animations: Built-in support for CSS transitions and animations.
- Transition Status: Track animation states with
transitionStatus(idle, opening, open, closing). - Accessibility: Proper ARIA attributes for screen readers.
- Keep Mounted: Control whether the panel stays in the DOM when closed.
- Hidden Until Found: Enable browser’s page search to find and expand content.
Components
Collapsible.Root
The root container that manages collapsible state. Props:open- Controlled open state (boolean)defaultOpen- Initial open state for uncontrolled mode (default:false)onOpenChange- Callback when open state changesdisabled- Disable all user interaction (default:false)
Collapsible.Trigger
A button that toggles the panel open and closed. Renders a<button> element.
Props:
disabled- Disable the trigger buttonnativeButton- Use native button behavior (default:true)
Collapsible.Panel
The collapsible panel containing the content. Renders a<div> element.
Props:
keepMounted- Keep panel in DOM when closed (default:false)hiddenUntilFound- Allow browser search to expand panel (default:false)
Styling Example
Controlled Example
CSS Variables
The component provides CSS variables for dynamic styling:--collapsible-panel-height- Current height of the panel in pixels--collapsible-panel-width- Current width of the panel in pixels