hu-menu-0-2
animateicons/hu-menu-0-2FreeComponent
animateicons publishes no description for this item.
Install it
npx shadcn@latest add https://animateicons.in/r/hu-menu-0-2.jsonSource
1"use client";23import { cn } from "@/lib/utils";4import type { Variants } from "motion/react";5import {6 LazyMotion,7 domMin,8 m,9 useAnimation,10 useReducedMotion,11} from "motion/react";12import {13 forwardRef,14 useCallback,15 useImperativeHandle,16 useRef,17 type HTMLAttributes,18} from "react";19export interface Menu02IconHandle {20 startAnimation: () => void;21 stopAnimation: () => void;22}2324interface Menu02IconProps extends Omit<25 HTMLAttributes<HTMLDivElement>,26 | "color"27 | "onDrag"28 | "onDragStart"29 | "onDragEnd"30 | "onAnimationStart"31 | "onAnimationEnd"32 | "onAnimationIteration"33> {34 size?: number;35 duration?: number;36 isAnimated?: boolean;37 color?: string;38}3940const Menu02Icon = forwardRef<Menu02IconHandle, Menu02IconProps>(41 (42 {43 onMouseEnter,44 onMouseLeave,45 className,46 size = 24,47 duration = 1,48 isAnimated = true,49 color,50 ...props51 },52 ref,53 ) => {54 const controls = useAnimation();55 const reduced = useReducedMotion();56 const isControlled = useRef(false);5758 useImperativeHandle(ref, () => {59 isControlled.current = true;60 return {61 startAnimation: () =>62 reduced ? controls.start("normal") : controls.start("animate"),63 stopAnimation: () => controls.start("normal"),64 };65 });6667 const handleEnter = useCallback(68 (e?: React.MouseEvent<HTMLDivElement>) => {69 if (!isAnimated || reduced) return;70 if (!isControlled.current) controls.start("animate");71 else onMouseEnter?.(e as any);72 },73 [controls, reduced, isAnimated, onMouseEnter],74 );7576 const handleLeave = useCallback(77 (e?: React.MouseEvent<HTMLDivElement>) => {78 if (!isControlled.current) controls.start("normal");79 else onMouseLeave?.(e as any);80 },81 [controls, onMouseLeave],82 );8384 const topVariants: Variants = {85 normal: { x: 0 },86 animate: {87 x: 6,88 transition: {89 type: "spring",90 stiffness: 300,91 damping: 18,92 delay: 0,93 duration: 0.4 * duration,94 },95 },96 };9798 const middleVariants: Variants = {99 normal: { x: 0 },100 animate: {101 x: 10,102 transition: {103 type: "spring",104 stiffness: 300,105 damping: 18,106 delay: 0.05 * duration,107 duration: 0.4 * duration,108 },109 },110 };111112 const bottomVariants: Variants = {113 normal: { x: 0 },114 animate: {115 x: 6,116 transition: {117 type: "spring",118 stiffness: 300,119 damping: 18,120 delay: 0.1 * duration,121 duration: 0.4 * duration,122 },123 },124 };125126 return (127 <LazyMotion features={domMin} strict>128 <m.div129// … truncated
What it pulls in
npm packages
Files it writes
More from animateicons
All 542 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| hu-activityhu-activity | animateicons | Components | Free | 1 dep | |
| hu-bookmarkhu-bookmark | animateicons | Components | Free | 1 dep | |
| hu-bookmark-checkhu-bookmark-check | animateicons | Components | Free | 1 dep | |
| hu-bookmark-minushu-bookmark-minus | animateicons | Components | Free | 1 dep | |
| hu-bookmark-removehu-bookmark-remove | animateicons | Components | Free | 1 dep | |
| hu-checkhu-check | animateicons | Components | Free | 1 dep | |
| hu-check-checkhu-check-check | animateicons | Components | Free | 1 dep | |
| hu-chevron-righthu-chevron-right | animateicons | Components | Free | 1 dep |
