Component

Accordion

A vertically stacked set of interactive headings that each reveal a section of content. Uses the headless @refraction-ui/accordion core.

Preview

Installation

$pnpm add @refraction-ui/react-accordion

Usage

tsx
import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from '@refraction-ui/react-accordion'

export function MyComponent() {
  return (
    <Accordion type="single" collapsible>
      <AccordionItem value="item-1">
        <AccordionTrigger>Is it accessible?</AccordionTrigger>
        <AccordionContent>Yes. It adheres to the WAI-ARIA design pattern.</AccordionContent>
      </AccordionItem>
      <AccordionItem value="item-2">
        <AccordionTrigger>Is it unstyled?</AccordionTrigger>
        <AccordionContent>Yes. It comes with default theme variables you can override.</AccordionContent>
      </AccordionItem>
    </Accordion>
  )
}

Props

PropTypeDefaultDescription
type'single' | 'multiple''single'Determines whether one or multiple items can be open at the same time.
defaultValuestring | string[]--The value of the item(s) to expand by default.
collapsiblebooleanfalseWhen type is "single", allows closing content when clicking trigger for an open item.