Command Palette

Search for a command to run...

Docs
Animated Accordion

Animated Accordion

An accordion with smooth Framer Motion animations for expand/collapse transitions.

Installation

Usage

import AccordionAnimated from "@/components/ruixen/accordion-animated";
 
const items = [
  {
    id: "1",
    title: "What animations are included?",
    content:
      "This accordion uses Framer Motion for smooth expand/collapse animations.",
  },
  {
    id: "2",
    title: "Is it accessible?",
    content:
      "Yes, the accordion maintains full keyboard navigation and screen reader support.",
  },
];
 
export default function MyAccordion() {
  return <AccordionAnimated items={items} defaultValue="1" />;
}

Props

PropTypeDefaultDescription
itemsAccordionAnimatedItem[]-Array of accordion items
defaultValuestring-ID of the initially open item
classNamestring-Additional CSS classes

Features

  • Smooth Animations: Uses Framer Motion for fluid expand/collapse transitions
  • Icon Animation: Chevron icon rotates smoothly on state change
  • Background Transition: Background color animates on open/close
  • Accessible: Maintains keyboard navigation and screen reader support