Join our Discord community
Accordion

Multi-level Accordion

Collapsible content panels with nested collapsible sections and table-style borders. Perfect for React applications requiring hierarchical content organization with seamless row connections and Next.js integration and TypeScript support.

Powered by

Loading component...

Installation

npx shadcn@latest add https://www.shadcn.io/registry/accordion-19.json
npx shadcn@latest add https://www.shadcn.io/registry/accordion-19.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/accordion-19.json
bunx shadcn@latest add https://www.shadcn.io/registry/accordion-19.json

Features

  • Multi-level nested design combining accordion and collapsible components for hierarchical content
  • Table-style connected borders with negative spacing creating seamless row appearance
  • Enhanced focus management with z-index layering and ring visibility controls in nested structure
  • Accent background sections for visual hierarchy differentiation between primary and secondary content
  • Chevron rotation animations with smooth transitions for both accordion and collapsible states
  • shadcn/ui integration using consistent design tokens and Tailwind CSS styling

Use Cases

This free open source React component works well for:

  • FAQ hierarchies - Main questions with sub-questions and detailed explanations built with Next.js
  • Documentation structures - Nested help sections with categorized information using TypeScript
  • Settings panels - Multi-level configuration options with grouped sub-settings for React applications
  • Menu structures - Category-based navigation with sub-menu organization using Tailwind CSS

API Reference

Accordion19

PropTypeDefaultDescription
type'single' | 'multiple'requiredWhether single or multiple items can be expanded
collapsiblebooleanfalseWhether expanded items can be collapsed
defaultValuestring | string[]undefinedDefault expanded item(s)
valuestring | string[]undefinedControlled expanded item(s)
onValueChange(value: string | string[]) => voidundefinedCallback when expanded items change

Accordion19Item

PropTypeDefaultDescription
valuestringrequiredUnique identifier for this accordion item

Accordion19Trigger

PropTypeDefaultDescription
childrenReactNoderequiredContent to display in the trigger button

Accordion19Content

PropTypeDefaultDescription
childrenReactNoderequiredContent to display when expanded

Accordion19Collapsible

PropTypeDefaultDescription
titlestringrequiredTitle text for the collapsible header
contentstringrequiredContent text to display when expanded
openbooleanfalseWhether the collapsible starts open

Implementation Notes

  • Combines accordion and collapsible components for true multi-level hierarchical content
  • Uses -space-y-px for negative spacing creating seamless table-like row connections
  • Accent background (bg-accent) provides visual differentiation for nested collapsible sections
  • Custom animations with data-[state=closed]:animate-collapsible-up and data-[state=open]:animate-collapsible-down
  • Zero padding on accordion content (p-0) allows collapsible sections to extend to edges
  • Compatible with shadcn/ui design system and Tailwind CSS utility classes