Collapsible
Collapsible is a component that shows or hides content.
CollapsibleContent API
Import
import * as Collapsible from '@base_ui/react/Collapsible';
const CollapsibleContent = Collapsible.Content;
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
className | func | string | - | Class names applied to the element or a function that returns them based on the component's state. |
htmlHidden | 'hidden' | 'until-found' | 'hidden' | The hidden state when closed |
render | element | func | - | A function to customize rendering of the component. |
ref
is forwarded to the root element.Theme default props
You can useCollapsibleContent
to change the default props of this component with the theme.CollapsibleRoot API
Import
import * as Collapsible from '@base_ui/react/Collapsible';
const CollapsibleRoot = Collapsible.Root;
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
animated | bool | true | If |
className | func | string | - | Class names applied to the element or a function that returns them based on the component's state. |
defaultOpen | bool | true | If |
disabled | bool | false | If |
onOpenChange | func | - | Callback fired when the Collapsible is opened or closed. |
open | bool | - | If |
render | element | func | - | A function to customize rendering of the component. |
ref
is forwarded to the root element.Theme default props
You can useCollapsibleRoot
to change the default props of this component with the theme.CollapsibleTrigger API
Import
import * as Collapsible from '@base_ui/react/Collapsible';
const CollapsibleTrigger = Collapsible.Trigger;
Props of the native component are also available.
Name | Type | Description |
---|---|---|
className | func | string | Class names applied to the element or a function that returns them based on the component's state. |
render | element | func | A function to customize rendering of the component. |
ref
is forwarded to the root element.Theme default props
You can useCollapsibleTrigger
to change the default props of this component with the theme.