Animated Menu
Animated menu with smooth transitions and content switching
Installation
Basic Usage
1import { AnimatedMenu } from "@/components/snippets/menu/Demo";2 3const tabs = [4 {5 id: 1,6 label: "Home",7 icon: <IconHome className="h-4 w-4" />,8 content: <div>Home</div>,9 },10 {11 id: 2,12 label: "Projects",13 icon: <IconDeviceLaptop className="h-4 w-4" />,14 content: <div>Projects</div>,15 },16 {17 id: 3,18 label: "About",19 icon: <IconUser className="h-4 w-4" />,20 content: <div>About</div>,21 },22 {23 id: 4,24 label: "Contact",25 icon: <IconMail className="h-4 w-4" />,26 content: <div>Contact</div>,27 },28];29 30<AnimatedMenu tabs={tabs} />;
Props
Examples
1<AnimatedMenu tabs={tabs} />
1<AnimatedMenu2 tabs={tabs}3 className="bg-linear-to-r from-purple-500 to-pink-500"4/>
Best Practices
- Clear Labels: Use descriptive and concise menu labels
- Consistent Icons: Use consistent icon styles throughout
- Logical Grouping: Group related menu items together
- Keyboard Navigation: Ensure all items are accessible via keyboard
- Loading States: Show loading indicators for dynamic content
Performance Tips
- Lazy Loading: Load content only when menu items are selected
- Animation Optimization: Use will-change CSS property for better performance
- Memoization: Memoize menu items to prevent unnecessary re-renders
- Debouncing: Debounce rapid menu changes to improve performance