Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
description: >- An interactive component which expands/collapses a panel.
Collapsible
Features
- Full keyboard navigation.
- Adheres to the Disclosure WAI-ARIA design pattern.
How to use the Radix UI Collapsible
The Collapsible Component is in the "Components Panel" under the "Radix" section. Click on it or drag it onto the canvas. The Collapsible will populate a template that's easy to adjust for your needs.
Radix UI Collapsible component within Webstudio
The Collapsible component consists of three main parts:
- Collapsible: The root component that controls the collapsible behavior.
- Collapsible Trigger: The button that toggles the collapsible.
- Collapsible Content: The component that contains the collapsible content.
Customizing the Collapsible
To customize the Collapsible component:
- Collapsible Trigger: Modify the trigger element to change what users click to expand/collapse the content. This can be text, an icon, or any combination of elements.
- Collapsible Content: Edit the content section to add whatever elements you want to show/hide when the collapsible is toggled.
- Styling: Any of the three components can be styled to match your design requirements.
Keep closed content in the HTML
Select Collapsible Content and enable Force Mount to keep its content in the HTML while the Collapsible is closed. New Collapsible components enable this setting by default. Disable it to remove closed content from the HTML.
When Force Mount is enabled, add a closed-state CSS rule such as height: 0 for [data-state="closed"]. Animation-only examples can leave the content visible because they assume Radix unmounts closed content.
Radix temporarily sets inline transition-duration: 0s and animation-name: none while it measures content height. This can suppress the first open animation, so test both the first open and later open/close cycles.
Using Collapsible for UI Patterns
The Collapsible component is useful for various UI patterns:
- FAQ sections
- "Show more" content sections
- Settings or preferences panels
- Mobile navigation menus
- Detail views that can be expanded/collapsed