| title | Collapsible |
|---|---|
| description | An interactive component that toggles the visibility of its content panel. |
| source | packages/raystack/components/collapsible |
| tag | new |
import { preview, controlledDemo, defaultOpenDemo, disabledDemo, } from "./demo.ts";
Import and assemble the component:
import { Collapsible } from '@raystack/apsara'
<Collapsible>
<Collapsible.Trigger />
<Collapsible.Panel />
</Collapsible>Groups all parts of the collapsible.
A button that toggles the visibility of the panel.
Contains the collapsible content.
You can control the collapsible state by providing open and onOpenChange props.
Use defaultOpen to have the panel initially expanded.
The collapsible can be disabled to prevent user interaction.
- The Trigger uses
aria-expandedto indicate the open/closed state of the panel. - Supports keyboard interaction with Enter and Space to toggle the panel.
- The Panel is automatically associated with the Trigger via
aria-controls. - Respects motion preferences: panel expand/collapse motion is enabled only when
prefers-reduced-motion: no-preference