Collapsible

An interactive component that expands and collapses content with smooth animations.

Overview

The Collapsible component provides an interactive way to show and hide content with smooth CSS transitions. Built on Base UI primitives, it supports both controlled and uncontrolled states, making it perfect for creating expandable sections, details panels, and progressive disclosure interfaces.

Usage

import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from "@tilt-legal/cubitt-components/primitives";
<Collapsible>
  <CollapsiblePanel>Your collapsible content goes here</CollapsiblePanel>
  <CollapsibleTrigger />
</Collapsible>

Examples

Card with Collapsible

Combine collapsible with cards to create expandable information panels.

Default Open

Start the collapsible in an open state by default.

Disabled

Prevent the collapsible from being toggled.

Nested

Create hierarchical collapsible sections by nesting multiple collapsibles.


API Reference

Collapsible

The root component that manages the collapsible state.

PropTypeDefaultDescription
openboolean-The controlled open state of the collapsible.
defaultOpenbooleanfalseThe default open state when uncontrolled.
onOpenChange(open: boolean) => void-Callback fired when the open state changes.
disabledbooleanfalseWhether the collapsible is disabled.
classNamestring-Additional CSS classes for the collapsible root.
renderReact.ReactElement | function-Allows replacing the component's HTML element.

CollapsiblePanel

The panel component that contains the collapsible content with animated height transitions.

PropTypeDefaultDescription
classNamestring-Additional CSS classes for the panel.
renderReact.ReactElement | function-Allows replacing the component's HTML element.

The panel includes built-in CSS transitions for smooth expand/collapse animations with automatic height calculation.

CollapsibleTrigger

The trigger component that toggles the collapsible state when clicked.

PropTypeDefaultDescription
renderReact.ReactElement | function-Allows replacing the component's HTML element. Use this to render as a custom element like Button.
classNamestring-Additional CSS classes for the trigger.

When using the render prop, the trigger will forward all collapsible state to the rendered element.

On this page