VisorVisor
ComponentsData Display

Accordion

Vertically stacked collapsible sections. Built on Radix UI with single or multiple expansion modes.

Single Mode

Only one item can be open at a time. With collapsible, clicking the open item closes it.

Multiple Mode

Multiple items can be expanded simultaneously.

CSS custom properties distributed via npm. Themes update automatically.

Copied into your project with full edit rights.

Disabled Item

Individual items can be disabled to prevent expansion.

Installation

npx visor add accordion

This copies two files into your project:

  • components/ui/accordion/accordion.tsx — the component
  • components/ui/accordion/accordion.module.css — the styles

Usage

import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from '@/components/ui/accordion/accordion';

export default function Example() {
  return (
    <Accordion type="single" collapsible>
      <AccordionItem value="item-1">
        <AccordionTrigger>Section One</AccordionTrigger>
        <AccordionContent>Content for section one.</AccordionContent>
      </AccordionItem>
    </Accordion>
  );
}

API Reference

AccordionProps

PropTypeDefaultDescription
type*'single' | 'multiple'Whether one or multiple items can be expanded at once.
collapsiblebooleanfalseWhen type is "single", allows closing the open item.
valuestring | string[]Controlled expanded item value(s).
defaultValuestring | string[]Default expanded item value(s) for uncontrolled usage.

The component also accepts all standard <div> HTML attributes.

Sub-components

ComponentElementPurpose
Accordion<div>Root container. Requires type prop.
AccordionItem<div>Individual collapsible section. Requires value prop.
AccordionTrigger<button>Toggle button with animated caret icon.
AccordionContent<div>Animated content area.

Accessibility

  • Built on Radix UI Accordion primitive — fully keyboard accessible.
  • Uses role="button" on triggers with aria-expanded state management.
  • ArrowDown / ArrowUp navigate between triggers; Enter or Space toggles.
  • Disabled items receive aria-disabled="true" and are skipped in keyboard navigation.
  • Content regions use role="region" linked to their trigger via aria-labelledby.