Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Collapsible

The Collapsible component groups content beneath a header that can be expanded or collapsed. It manages its own state by default and can also be controlled by a parent component.

Import

1
import { Collapsible } from '@payloadcms/ui'

Basic usage

Loading component example…

Use a concise header that describes the hidden content. The entire header is used as the toggle target unless disableHeaderToggle is enabled.

Error state

Loading component example…

Use the error style when the section contains invalid fields that require attention.

Common props

These are the props most commonly used with this component. See its exported types in @payloadcms/ui for the complete list.

Prop

Type

Default

Description

children *

ReactNode

Content displayed inside the collapsible section.

header

ReactNode

Content displayed in the section header.

actions

ReactNode

Displays controls on the trailing edge of the header.

collapsibleStyle

'default' | 'error'

'default'

Sets the visual state.

initCollapsed

boolean

false

Sets the initial uncontrolled state.

isCollapsed

boolean

Controls the collapsed state from a parent component.

onToggle

(collapsed: boolean) => void

Runs when the section is toggled.

disableHeaderToggle

boolean

false

Prevents the header from toggling the section.

disableToggleIndicator

boolean

false

Hides the trailing chevron.

AfterCollapsible

ReactNode

Renders content after the collapsible content wrapper.

* An asterisk denotes that a prop is required.

Was this page helpful?

Next

CopyToClipboard