Hero Ui

HeroUI Accordion

Component

About

HeroUI v3 Accordion — a collapsible content panel built with the real @heroui/react package. Default and surface variants, single or multiple expanded, controlled and default-expanded keys, custom indicator, disabled items, hidden separators, grouped FAQ layout and custom styles. Works in light and dark themes.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds HeroUI Accordion to your project and fits it to your theme.

Code

How HeroUI Accordion is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { Accordion } from "@/components/ui/heroui-accordion"

const items = [
  { id: "getting-started", q: "Getting Started", a: "Learn the basics of HeroUI and how to integrate it into your React project. This section covers installation, setup, and your first component." },
  { id: "core-concepts", q: "Core Concepts", a: "Understand the core ideas behind HeroUI: variants, slots, theming tokens and accessibility built on React Aria." },
  { id: "advanced", q: "Advanced Usage", a: "Compose components, build custom variants, and integrate HeroUI with your design system." },
  { id: "best-practices", q: "Best Practices", a: "Follow recommended patterns for performance, accessibility, and maintainable component composition." },
]

export default function Multiple() {
  return (
    <div className="flex min-h-screen w-full items-center justify-center p-8">
      <Accordion allowsMultipleExpanded className="w-full max-w-md">
        {items.map((f) => (
          <Accordion.Item key={f.id} id={f.id}>
            <Accordion.Heading>
              <Accordion.Trigger>
                {f.q}
                <Accordion.Indicator />
              </Accordion.Trigger>
            </Accordion.Heading>
            <Accordion.Panel>
              <Accordion.Body>{f.a}</Accordion.Body>
            </Accordion.Panel>
          </Accordion.Item>
        ))}
      </Accordion>
    </div>
  )
}

Dependencies

More by Hero Ui

View all
  • DatePicker

    DatePicker

    465
  • Chip

    Chip

    440
  •  The Pagination

    The Pagination

    361
  • HeroUI Color Picker

    HeroUI Color Picker

    105
  • Skeleton

    Skeleton

    104
  • HeroUI Table

    HeroUI Table

    100
  • HeroUI Disclosure Group

    HeroUI Disclosure Group

    94
  • HeroUI AlertDialog

    HeroUI AlertDialog

    80