arrow-up-right
lucide-animated-pqoqubbw/arrow-up-rightFreeComponent
lucide-animated publishes no description for this item.
Install it
npx shadcn@latest add https://lucide-animated.com/r/arrow-up-right.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 ArrowUpRightIconHandle {11 startAnimation: () => void;12 stopAnimation: () => void;13}1415interface ArrowUpRightIconProps extends HTMLAttributes<HTMLDivElement> {16 size?: number;17}1819const ARROW_VARIANTS: Variants = {20 normal: {21 scale: 1,22 translateX: 0,23 translateY: 0,24 },25 animate: {26 scale: [1, 0.85, 1],27 translateX: [0, -4, 0],28 translateY: [0, 4, 0],29 originX: 1,30 originY: 0,31 transition: {32 duration: 0.5,33 ease: "easeInOut",34 },35 },36};3738const ArrowUpRightIcon = forwardRef<39 ArrowUpRightIconHandle,40 ArrowUpRightIconProps41>(({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {42 const controls = useAnimation();43 const isControlledRef = useRef(false);4445 useImperativeHandle(ref, () => {46 isControlledRef.current = true;47 return {48 startAnimation: () => controls.start("animate"),49 stopAnimation: () => controls.start("normal"),50 };51 });5253 const handleMouseEnter = useCallback(54 (e: React.MouseEvent<HTMLDivElement>) => {55 if (!isControlledRef.current) controls.start("animate");56 onMouseEnter?.(e);57 },58 [controls, onMouseEnter]59 );6061 const handleMouseLeave = useCallback(62 (e: React.MouseEvent<HTMLDivElement>) => {63 if (!isControlledRef.current) controls.start("normal");64 onMouseLeave?.(e);65 },66 [controls, onMouseLeave]67 );6869 return (70 <div71 className={cn(className)}72 onMouseEnter={handleMouseEnter}73 onMouseLeave={handleMouseLeave}74 {...props}75 >76 <svg77 fill="none"78 height={size}79 stroke="currentColor"80 strokeLinecap="round"81 strokeLinejoin="round"82 strokeWidth="2"83 viewBox="0 0 24 24"84 width={size}85 xmlns="http://www.w3.org/2000/svg"86 >87 <motion.g animate={controls} variants={ARROW_VARIANTS}>88 <path d="M7 7H17" />89 <path d="M17 7V17" />90 <path d="M7 17L17 7" />91 </motion.g>92 </svg>93 </div>94 );95});9697ArrowUpRightIcon.displayName = "ArrowUpRightIcon";9899export { ArrowUpRightIcon };
What it pulls in
npm packages
Files it writes
More from lucide-animated
All 464 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| a-arrow-downa-arrow-down | lucide-animated | Components | Free | 1 dep | |
| 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 |
