GitHub

Accordion

Vertically stacked interactive headings that reveal content sections

Basic Usage

Loading...

Installation

pnpm add @corew500/ui

Usage

import { Accordion } from "@corew500/ui/accordion"

<Accordion>Content</Accordion>

CMS Integration

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

API Reference

Props

PropTypeDefaultDescription
valueAccordionValueThe controlled value of the item(s) that should be expanded. To render an uncontrolled accordion, use the `defaultValue` prop instead.
defaultValueAccordionValueThe uncontrolled value of the item(s) that should be initially expanded. To render a controlled accordion, use the `value` prop instead.
disabledenumfalseWhether the component should ignore user interaction.
hiddenUntilFoundenumfalseAllows the browser’s built-in page search to find and expand the panel contents. Overrides the `keepMounted` prop and uses `hidden="until-found"` to hide the element without removing it from the DOM.
keepMountedenumfalseWhether to keep the element in the DOM while the panel is closed. This prop is ignored when `hiddenUntilFound` is used.
loopFocusenumtrueWhether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys.
onValueChange(value: AccordionValue, eventDetails: AccordionRootChangeEventDetails) => voidEvent handler called when an accordion item is expanded or collapsed. Provides the new value as an argument.
multipleenumfalseWhether multiple items can be open at the same time.
orientationenum'vertical'The visual orientation of the accordion. Controls whether roving focus uses left/right or up/down arrow keys.
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

  • Trigger buttons are keyboard navigable with Enter/Space to toggle.

Screen Readers

  • - Uses `role="region"` for content panels.
  • Expanded state is announced via `aria-expanded`.
  • Content panels use `aria-labelledby` to reference their trigger.

Localization

Translatable Content

  • - All visible text (trigger labels, content) should be passed as translated strings.