a-arrow-down
lucide-animated-pqoqubbw/a-arrow-downFreeComponent
lucide-animated publishes no description for this item.
Install it
npx shadcn@latest add https://lucide-animated.com/r/a-arrow-down.jsonSource
1"use client";23import type { Variants } from "motion/react";4import { motion, useAnimation } from "motion/react";5import type { HTMLAttributes } from "react";6import { forwardRef, useCallback, useImperativeHandle, useRef } from "react";78import { cn } from "@/lib/utils";910export interface AArrowDownIconHandle {11 startAnimation: () => void;12 stopAnimation: () => void;13}1415interface AArrowDownIconProps extends HTMLAttributes<HTMLDivElement> {16 size?: number;17}1819const LETTER_VARIANTS: Variants = {20 normal: { opacity: 1, scale: 1 },21 animate: {22 opacity: [0, 1],23 scale: [0.8, 1],24 transition: { duration: 0.3 },25 },26};2728const ARROW_VARIANTS: Variants = {29 normal: { opacity: 1, y: 0 },30 animate: {31 opacity: [0, 1],32 y: [-10, 0],33 transition: { duration: 0.3, delay: 0.2 },34 },35};3637const AArrowDownIcon = forwardRef<AArrowDownIconHandle, AArrowDownIconProps>(38 ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {39 const controls = useAnimation();40 const isControlledRef = useRef(false);4142 useImperativeHandle(ref, () => {43 isControlledRef.current = true;4445 return {46 startAnimation: () => controls.start("animate"),47 stopAnimation: () => controls.start("normal"),48 };49 });5051 const handleMouseEnter = useCallback(52 (e: React.MouseEvent<HTMLDivElement>) => {53 if (isControlledRef.current) {54 onMouseEnter?.(e);55 } else {56 controls.start("animate");57 }58 },59 [controls, onMouseEnter]60 );6162 const handleMouseLeave = useCallback(63 (e: React.MouseEvent<HTMLDivElement>) => {64 if (isControlledRef.current) {65 onMouseLeave?.(e);66 } else {67 controls.start("normal");68 }69 },70 [controls, onMouseLeave]71 );7273 return (74 <div75 className={cn(className)}76 onMouseEnter={handleMouseEnter}77 onMouseLeave={handleMouseLeave}78 {...props}79 >80 <svg81 fill="none"82 height={size}83 stroke="currentColor"84 strokeLinecap="round"85 strokeLinejoin="round"86 strokeWidth="2"87 viewBox="0 0 24 24"88 width={size}89 xmlns="http://www.w3.org/2000/svg"90 >91 <motion.path92 animate={controls}93 d="M3.5 13h6"94 variants={LETTER_VARIANTS}95 />96 <motion.path97 animate={controls}98 d="m2 16 4.5-9 4.5 9"99// … truncated
What it pulls in
npm packages
Files it writes
More from lucide-animated
All 464 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| a-arrow-upa-arrow-up | lucide-animated | Components | Free | 1 dep | |
| accessibilityaccessibility | lucide-animated | Components | Free | 1 dep | |
| activityactivity | lucide-animated | Components | Free | 1 dep | |
| air-ventair-vent | lucide-animated | Components | Free | 1 dep | |
| airplaneairplane | lucide-animated | Components | Free | 1 dep | |
| airplayairplay | lucide-animated | Components | Free | 1 dep | |
| alarm-clockalarm-clock | lucide-animated | Components | Free | 1 dep | |
| alarm-clock-checkalarm-clock-check | lucide-animated | Components | Free | 1 dep |
