structyl

Collapsible API

View component

The full prop reference for the Collapsible component. An interactive component that expands / collapses a panel.

Import

tsx
import { Collapsible } from '@structyl/styled';

Props

Root

The root container for the collapsible component. Manages open/closed state and provides context to child components.

PropTypeDefault
open#boolean

Controlled open state of the collapsible

defaultOpen#boolean

Initial uncontrolled open state

false
onOpenChange#(open: boolean) => void

Callback fired when the open state changes

disabled#boolean

Whether the collapsible is disabled (disables trigger)

asChild#boolean

Use the component's child as the root element instead of creating a div

className#string

CSS class name for the root element

...htmlAttributes#React.ComponentPropsWithoutRef<'div'>

All standard HTML div attributes (e.g. id, data-*, aria-*, etc.)

Trigger

The clickable button that toggles the collapsible open/closed state. Styled variant includes default flex/cursor/transition classes.

PropTypeDefault
asChild#boolean

Use the component's child as the trigger element instead of creating a button

className#string

CSS class name (merged with default styled classes: flex cursor-pointer items-center justify-between font-medium transition-all)

...htmlAttributes#React.ComponentPropsWithoutRef<'button'>

All standard HTML button attributes (e.g. type, id, data-*, aria-expanded, aria-controls, etc.)

Content

The collapsible content panel that shows/hides based on open state. Styled variant includes overflow-hidden and animation classes.

PropTypeDefault
forceMount#boolean

Force the content to be mounted in the DOM even when closed (useful for animations)

className#string

CSS class name (merged with default styled classes: overflow-hidden text-sm data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down)

asChild#boolean

Use the component's child as the content element instead of creating a div

...htmlAttributes#React.ComponentPropsWithoutRef<'div'>

All standard HTML div attributes (e.g. id, data-*, aria-*, etc.)

Source code

If you didn't find what you need here, read the component implementation .

structyl — Accessible React Component Library