Collapsible
Basic Usage
Loading...
Installation
pnpm add @corew500/uiUsage
import { Collapsible } from "@corew500/ui/collapsible"
<Collapsible>Content</Collapsible>CMS Integration
Loading...
API Reference
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| open | enum | — | Whether the collapsible panel is currently open. To render an uncontrolled collapsible, use the `defaultOpen` prop instead. |
| defaultOpen | enum | false | Whether the collapsible panel is initially open. To render a controlled collapsible, use the `open` prop instead. |
| onOpenChange | (open: boolean, eventDetails: CollapsibleRootChangeEventDetails) => void | — | Event handler called when the panel is opened or closed. |
| disabled | enum | false | Whether the component should ignore user interaction. |
| style | enum | — | Style applied to the element, or a function that returns a style object based on the component’s state. |
| className | enum | — | CSS class applied to the element, or a function that returns a class based on the component’s state. |
| render | enum | — | Allows you to replace the component’s HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
Accessibility
Keyboard Navigation
- Keyboard: Enter/Space toggles the collapsible.
Screen Readers
- - Trigger has `aria-expanded` reflecting current state.
- Content is hidden from screen readers when collapsed.
Localization
Translatable Content
- - Trigger text should be passed as translated strings.