A modern, animated React component for rendering a list of collapsible items with smooth transitions, accessibility, and an optional interactive animated gradient. Perfect for FAQs, settings panels, or revealing progressive content.
This component is inspired by the best UX patterns for accordions in today's UI libraries.
You can install the Accordion component using the following CLI command, or copy the implementation below:
1npx shadcn@latest add http://localhost:3000/r/accordion.jsonTo use the Accordion component, import it in your code:
1import Accordion from '@/components/accordion';The Accordion component accepts the following props:
| Prop | Type | Default | Description | Required |
|---|---|---|---|---|
items | AccordionItem[] | See below | Array of accordion sections to show. Each one includes a title and any React content. | No |
1interface AccordionItem {
2 title: string // The heading for the section
3 content: React.ReactNode // Rendered content when expanded
4}1<Accordion />1const items: AccordionItem[] = [
2 {
3 title: 'Getting Started',
4 content: <div>First, install QuartzUI...</div>,
5 },
6 {
7 title: 'Customizable',
8 content: <div>You can pass any React node as content...</div>,
9 },
10 {
11 title: 'Powered by motion and Tabler icons',
12 content: <div>Animations and icons are built-in.</div>,
13 },
14];
15
16<Accordion items={items} /><button> with aria-expanded, aria-controls, and aria-labelledby.GRADIENT_RADIUS) are easily customized.