Collapsible

A collapsible panel controlled by a button.

API reference

Import the component and assemble its parts:

Anatomy
import { Collapsible } from '@base-ui-components/react/collapsible';
<Collapsible.Root>  <Collapsible.Trigger />  <Collapsible.Panel /></Collapsible.Root>

Root

Groups all parts of the collapsible. Renders a <div> element.

PropTypeDefault
defaultOpen

boolean

false

open

boolean

undefined

onOpenChange

(open) => void

undefined

disabled

boolean

false

className

string | (state) => string

undefined

Trigger

A button that opens and closes the collapsible panel. Renders a <button> element.

PropTypeDefault
className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-panel-open

Panel

A panel with the collapsible contents. Renders a <div> element.

PropTypeDefault
hiddenUntilFound

boolean

false

className

string | (state) => string

undefined

keepMounted

boolean

false

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-open
data-closed
data-starting-style
data-ending-style
CSS Variable
Description
--collapsible-panel-height
--collapsible-panel-width