Accordion

A vertically stacked set of interactive headings that each reveal a section of content, with four style variants and a streaming answer.

@spectrumui/accordion

Installation

Login to view commandCreate a free account to access the install command

Variants

Card

variant="card" separates every item into its own bordered surface, and the border firms up while the panel is open.

@spectrumui/accordion-card

Filled

variant="filled" drops the borders for soft panels. Paired here with indicator="plus", which morphs into a minus on open, and type="multiple" so several answers can stay open at once.

@spectrumui/accordion-filled

Orders leave the warehouse within two business days and arrive in three to seven, depending on the destination.

Ghost

variant="ghost" removes every surface and rule, leaving the text to carry the structure — useful inside a page that already has its own frame.

@spectrumui/accordion-ghost

Generating answer

AccordionStreamingContent types the answer out the way a model writes it. The panel opens to the height of the finished text, so nothing below it shifts as the words arrive, and screen readers get the complete answer rather than one character at a time. Tune it with speed and startDelay.

@spectrumui/accordion-generative

Overview

A vertically stacked set of interactive headings that each reveal a section of content.

This disclosure component is intended for interfaces that need a vertically stacked set of interactive headings that each reveal a section of content, documentation pages, and support centers. Its implementation is provided as editable source so the final behavior and styling stay inside your project.

Technologies

React
TypeScript
Tailwind CSS
shadcn/ui
Radix UI

No additional package dependency is declared for this component.

Usage

The live preview and its Code tab above are the working example for this component. Copy the example after installation, then provide the required values from its TypeScript signature.

Props

PropTypeRequiredDescription
—No shared Props type—The installable source does not expose one shared custom prop contract. Review the exported TypeScript signatures for the individual variants shown on this page.

Use cases

  • interfaces that need a vertically stacked set of interactive headings that each reveal a section of content
  • documentation pages
  • support centers

Features

  • Copy-paste source that remains in your repository
  • TypeScript source included with the component
  • Tailwind CSS classes editable in the component source
  • shadcn/ui dependencies: local UI primitives
  • Spectrum UI registry dependencies: @spectrumui/accordion-dependencies
  • Reduced-motion handling present in the source

Accessibility

  • The source uses Radix UI primitives for the interactions detected on this component.
  • The source includes ARIA attributes or roles; preserve them when customizing the component.
  • The source checks reduced-motion preferences or includes motion-reduce styles.
  • Test focus order, keyboard operation, labels, contrast, and screen-reader output in the final application context.

Customization

  • Edit the Tailwind utility classes in the copied source to match your spacing, color, and typography tokens.
  • Use the documented className surface for local layout adjustments, then edit the source for structural changes.

Topic guides

See how this component fits into broader interface patterns, implementation decisions, and working examples.

Accordion FAQ

Is Accordion free to use in commercial projects?

Yes. The public Accordion source is available under the Apache License 2.0, including for commercial use, subject to the LICENSE terms.

How do I install Accordion?

Run npx shadcn@latest add @spectrumui/accordion or npx shadcn@latest add @spectrumui/accordion-card or npx shadcn@latest add @spectrumui/accordion-filled or npx shadcn@latest add @spectrumui/accordion-ghost or npx shadcn@latest add @spectrumui/accordion-generative. The page also exposes the source for manual installation.

Does Accordion require Motion?

No Motion dependency was detected in the documented source or registry entry for Accordion.

Does Accordion use shadcn/ui or Radix UI?

Accordion uses local shadcn/ui primitives and imports Radix UI directly.

Can I use Accordion in Next.js?

The documented React source is used in this Next.js application. Keep its use client directive when copying it into the App Router. Install the detected dependencies and verify any application-specific data or image configuration.

What accessibility checks should I run for Accordion?

The source includes Radix UI primitives, ARIA markup, reduced-motion handling. Test the finished interface with keyboard and screen-reader workflows.

Work with me