--- title: Accordion description: A vertically stacked set of interactive headings that each reveal a section of content. component: true links: doc: https://www.radix-ui.com/docs/primitives/components/accordion api: https://www.radix-ui.com/docs/primitives/components/accordion#api-reference --- ## Installation CLI Manual ```bash npx shadcn@latest add accordion ``` Install the following dependencies: ```bash npm install @radix-ui/react-accordion ``` Copy and paste the following code into your project. Update the import paths to match your project setup. Update `tailwind.config.js` Add the following animations to your `tailwind.config.js` file: ```js title="tailwind.config.js" {5-18} /** @type {import('tailwindcss').Config} */ module.exports = { theme: { extend: { keyframes: { "accordion-down": { from: { height: "0" }, to: { height: "var(--radix-accordion-content-height)" }, }, "accordion-up": { from: { height: "var(--radix-accordion-content-height)" }, to: { height: "0" }, }, }, animation: { "accordion-down": "accordion-down 0.2s ease-out", "accordion-up": "accordion-up 0.2s ease-out", }, }, }, } ``` ## Usage ```tsx import { Accordion, AccordionContent, AccordionItem, AccordionTrigger, } from "@/components/ui/accordion" ``` ```tsx Is it accessible? Yes. It adheres to the WAI-ARIA design pattern. ```