The Accordion component is a flexible and accessible UI element built using Radix UI primitives. It allows for the creation of collapsible sections, ideal for organizing content in a compact and user-friendly manner. The component supports both single and multiple expanded items, making it versatile for various use cases.
Key features include:
Radix UI Integration: Utilizes Radix UI for robust accessibility and state management.
Customizable Styles: Easily style the accordion using Tailwind CSS classes.
Animation Support: Smooth open and close animations enhance the user experience.
To enable animations, add the following to your tailwind.config.js:
{
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",
},
},
},
}
This component is ideal for creating FAQ sections, feature lists, or any content that benefits from being organized in an expandable format.