Components
Loading preview...
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.
npx shadcn@latest add https://21st.dev/r/hero_ui/heroui-accordionimport { Accordion } from "@/components/ui/heroui-accordion"
const faqs = [
{ id: "order", q: "How do I place an order?", a: "Browse our products, add items to your cart, and proceed to checkout. You'll need to provide shipping and payment information to complete your purchase." },
{ id: "modify", q: "Can I modify or cancel my order?", a: "Yes, you can modify or cancel your order before it's shipped. Once your order is processed, you can't make changes." },
{ id: "payment", q: "What payment methods do you accept?", a: "We accept all major credit cards, including Visa, Mastercard, and American Express." },
]
export default function DefaultExpanded() {
return (
<div className="flex min-h-screen w-full items-center justify-center p-8">
<Accordion defaultExpandedKeys={["order"]} className="w-full max-w-md">
{faqs.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>
)
}