A simple show/hide component with a trigger and content area. Useful for secondary information that doesn't need to be always visible.

import Collapsible from "@radui/ui/Collapsible"
Example
React
"use client" import Collapsible from "@radui/ui/Collapsible" const CollapsibleExample = () => { return ( <div className="flex flex-col gap-4 w-[320px]"> <Collapsible.Root> <Collapsible.Trigger className="w-full flex justify-between items-center px-4 py-2 rounded-lg border font-medium cursor-pointer"> What is Rad UI? <span>▾</span> </Collapsible.Trigger> <Collapsible.Content className="px-4 py-2 text-gray-950"> Rad UI is a headless component library for React. Build your own design system on top of accessible, unstyled primitives. </Collapsible.Content> </Collapsible.Root> <Collapsible.Root> <Collapsible.Trigger className="w-full flex justify-between items-center px-4 py-2 rounded-lg border font-medium cursor-pointer"> Is it accessible? <span>▾</span> </Collapsible.Trigger> <Collapsible.Content className="px-4 py-2 text-gray-950"> Yes. All components follow WAI-ARIA patterns and support full keyboard navigation. </Collapsible.Content> </Collapsible.Root> </div> ) } export default CollapsibleExample
  • Open state is controlled with open and onOpenChange, or uncontrolled with defaultOpen
  • The trigger carries aria-expanded and aria-controls for the content
  • hiddenUntilFound keeps closed content searchable with the browser's find
  • Exposes data-state for CSS transitions, and keeps content mounted while one finishes

Import all parts of the component and piece them together.

React
import Collapsible from "@radui/ui/Collapsible" export default () => { return ( <Collapsible.Root> <Collapsible.Trigger /> <Collapsible.Content /> </Collapsible.Root> ) }

The root collapsible container.

PropTypeDefault
open
booleanfalse
defaultOpen
booleanfalse
disabled
booleanfalse
transitionDuration
number0
onOpenChange
function—
customRootClass
string""

The button that toggles the collapsible open/closed.

PropTypeDefault
asChild
booleanfalse
className
string""

The content that is shown or hidden.

PropTypeDefault
className
string""
hiddenUntilFound
booleanfalse
forceMount
booleanfalse
ShortcutDescription
Tab

Moves focus to the Collapsible.Trigger.

Space

Toggles the controlled content open or closed.

Enter

Toggles the controlled content open or closed.

Escape

When the content is open and focus is on the trigger, closes the content.

ReferenceWhat Rad UI follows
Disclosure pattern

Uses a button trigger with aria-expanded and aria-controls to expose the content relationship.