align-horizontal
lucide-animated-icons/align-horizontalFreeComponent
lucide-animated publishes no description for this item.
Install it
npx shadcn@latest add https://icons.pqoqubbw.dev/r/align-horizontal.jsonSource
1"use client";23import type { Transition } 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 AlignHorizontalIconHandle {11 startAnimation: () => void;12 stopAnimation: () => void;13}1415interface AlignHorizontalIconProps extends HTMLAttributes<HTMLDivElement> {16 size?: number;17}1819const DEFAULT_TRANSITION: Transition = {20 type: "spring",21 stiffness: 160,22 damping: 17,23 mass: 1,24};2526const AlignHorizontalIcon = forwardRef<27 AlignHorizontalIconHandle,28 AlignHorizontalIconProps29>(({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {30 const controls = useAnimation();31 const isControlledRef = useRef(false);3233 useImperativeHandle(ref, () => {34 isControlledRef.current = true;3536 return {37 startAnimation: () => controls.start("animate"),38 stopAnimation: () => controls.start("normal"),39 };40 });4142 const handleMouseEnter = useCallback(43 (e: React.MouseEvent<HTMLDivElement>) => {44 if (isControlledRef.current) {45 onMouseEnter?.(e);46 } else {47 controls.start("animate");48 }49 },50 [controls, onMouseEnter]51 );5253 const handleMouseLeave = useCallback(54 (e: React.MouseEvent<HTMLDivElement>) => {55 if (isControlledRef.current) {56 onMouseLeave?.(e);57 } else {58 controls.start("normal");59 }60 },61 [controls, onMouseLeave]62 );6364 return (65 <div66 className={cn(className)}67 onMouseEnter={handleMouseEnter}68 onMouseLeave={handleMouseLeave}69 {...props}70 >71 <svg72 fill="none"73 height={size}74 stroke="currentColor"75 strokeLinecap="round"76 strokeLinejoin="round"77 strokeWidth="2"78 viewBox="0 0 24 24"79 width={size}80 xmlns="http://www.w3.org/2000/svg"81 >82 <motion.rect83 animate={controls}84 height="10"85 rx="2"86 transition={DEFAULT_TRANSITION}87 variants={{88 normal: { scaleX: 1 },89 animate: { scaleX: 0.85 },90 }}91 width="6"92 x="9"93 y="7"94 />95 <motion.path96 animate={controls}97 d="M4 22V2"98 transition={DEFAULT_TRANSITION}99 variants={{100 normal: { translateX: 0, scaleY: 1 },101 animate: {102// … 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 |
