audio-lines
lucide-animated-pqoqubbw/audio-linesFreeComponent
lucide-animated publishes no description for this item.
Install it
npx shadcn@latest add https://lucide-animated.com/r/audio-lines.jsonSource
1"use client";23import { motion, useAnimation } from "motion/react";4import type { HTMLAttributes } from "react";5import { forwardRef, useCallback, useImperativeHandle, useRef } from "react";67import { cn } from "@/lib/utils";89export interface AudioLinesIconHandle {10 startAnimation: () => void;11 stopAnimation: () => void;12}1314interface AudioLinesIconProps extends HTMLAttributes<HTMLDivElement> {15 size?: number;16}1718const AudioLinesIcon = forwardRef<AudioLinesIconHandle, AudioLinesIconProps>(19 ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {20 const controls = useAnimation();21 const isControlledRef = useRef(false);2223 useImperativeHandle(ref, () => {24 isControlledRef.current = true;2526 return {27 startAnimation: () => controls.start("animate"),28 stopAnimation: () => controls.start("normal"),29 };30 });3132 const handleMouseEnter = useCallback(33 (e: React.MouseEvent<HTMLDivElement>) => {34 if (isControlledRef.current) {35 onMouseEnter?.(e);36 } else {37 controls.start("animate");38 }39 },40 [controls, onMouseEnter]41 );4243 const handleMouseLeave = useCallback(44 (e: React.MouseEvent<HTMLDivElement>) => {45 if (isControlledRef.current) {46 onMouseLeave?.(e);47 } else {48 controls.start("normal");49 }50 },51 [controls, onMouseLeave]52 );5354 return (55 <div56 className={cn(className)}57 onMouseEnter={handleMouseEnter}58 onMouseLeave={handleMouseLeave}59 {...props}60 >61 <svg62 fill="none"63 height={size}64 stroke="currentColor"65 strokeLinecap="round"66 strokeLinejoin="round"67 strokeWidth="2"68 viewBox="0 0 24 24"69 width={size}70 xmlns="http://www.w3.org/2000/svg"71 >72 <path d="M2 10v3" />73 <motion.path74 animate={controls}75 d="M6 6v11"76 variants={{77 normal: { d: "M6 6v11" },78 animate: {79 d: ["M6 6v11", "M6 10v3", "M6 6v11"],80 transition: {81 duration: 1.5,82 repeat: Number.POSITIVE_INFINITY,83 },84 },85 }}86 />87 <motion.path88 animate={controls}89 d="M10 3v18"90 variants={{91 normal: { d: "M10 3v18" },92 animate: {93// … truncated
What it pulls in
npm packages
Files it writes
More from lucide-animated
All 466 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 |
