GitHub

Collapsible

Expandable/collapsible content section

Basic Usage

Loading...

Installation

pnpm add @corew500/ui

Usage

import { Collapsible } from "@corew500/ui/collapsible"

<Collapsible>Content</Collapsible>

CMS Integration

CMSPayload CMS Integration
This component supports CMS-driven content via @corew500/cms-payload.
Loading...

API Reference

Props

PropTypeDefaultDescription
openenumWhether the collapsible panel is currently open. To render an uncontrolled collapsible, use the `defaultOpen` prop instead.
defaultOpenenumfalseWhether the collapsible panel is initially open. To render a controlled collapsible, use the `open` prop instead.
onOpenChange(open: boolean, eventDetails: CollapsibleRootChangeEventDetails) => voidEvent handler called when the panel is opened or closed.
disabledenumfalseWhether the component should ignore user interaction.
styleenumStyle applied to the element, or a function that returns a style object based on the component’s state.
classNameenumCSS class applied to the element, or a function that returns a class based on the component’s state.
renderenumAllows 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.