Components / Navigation
Animated Menu
A hamburger that morphs into an ✕ and opens a dropdown with staggered links.
Installation
Requires React 18+ and Tailwind CSS.
- 1
Install dependencies
$ npm install motion - 2
Add the component
Copy the code from the Code tab above into
components/ui/animated-menu.tsx. - 3
Use it
example.tsximport { AnimatedMenu } from "@/components/ui/animated-menu"; const items = [ { label: "Home", href: "#" }, { label: "Components", href: "#" }, { label: "Pricing", href: "#" }, { label: "Blog", href: "#" }, { label: "Contact", href: "#" }, ]; export default function AnimatedMenuDemo() { return ( <div className="flex h-72 w-full max-w-sm items-start justify-end rounded-2xl border border-zinc-200 bg-white p-4 dark:border-white/10 dark:bg-zinc-900/50"> <AnimatedMenu items={items} /> </div> ); }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| items | { label: string; href?: string; onClick?: () => void }[] | — | Menu links. |
| align | "left" | "right" | "right" | Which side the panel lines up with. |