Collapsible

Collapsible

An interactive component which expands/collapses a panel.

AsChild Pattern

Use AsChild to compose triggers with your own styled Button components.

Without AsChild

CollapsibleTrigger renders its own button with inline classes.

With AsChild

Button receives trigger behavior via TriggerContext.

Basic Usage

A simple collapsible with trigger and content.

Controlled Mode

Control the open state programmatically.

Disabled State

Disable interaction with the collapsible.

Accordion Style (Multiple Collapsibles)

Multiple collapsibles working independently.

With Icons and Badges

Enhance collapsibles with visual indicators.

Nested Collapsibles

Collapsibles can contain other collapsibles for hierarchical content.

With Smooth Animations

Add CSS transitions for smooth expand/collapse effects.

Accessibility Notes

Best practices for accessible collapsibles.

✓ Keyboard navigation: Trigger responds to Space and Enter keys.

✓ ARIA attributes: aria-expanded reflects the current state.

✓ Screen readers: Content uses region role and aria-hidden.

✓ Focus management: Focus remains on trigger after expanding/collapsing.

✓ Semantic HTML: Proper button elements for triggers.

API Reference

Component parameters and their types.

Prop Type Default Description
Open bool false Controls whether the collapsible is expanded.
OpenChanged EventCallback<bool> — Callback invoked when the open state changes.
Disabled bool false Prevents toggling when true.
AsChild bool false On CollapsibleTrigger: passes trigger behavior to the child element.
Class string? null Additional CSS classes for the root element.
ChildContent RenderFragment? null Content inside the component.

Reconnecting...

Attempting to rejoin the server

Connection Lost

Retrying in seconds

Connection Failed

Failed to rejoin the server.
Please retry or reload the page.

Session Paused

The session has been paused by the server

Resume Failed

Failed to resume the session.
Please reload the page.