This component no longer exists. It was in shadcn/ui’s manifest when we first indexed it and is not there now — the registry served its inventory on 2026-08-13 and this item was not on it. The install command below will fail. It is kept here because a tutorial somewhere still tells people to run it.
Direction Aware Hover
zenithui-chandubobbili/direction-aware-hoverRemovedComponent
A direction aware hover effect using Framer Motion.
Install it
npx shadcn@latest add https://zenithui.chandubobbili.dev/r/direction-aware-hover.jsonSource
1"use client"23import { useRef, useState } from "react"45import { AnimatePresence, motion } from "motion/react"6import { cn } from "@/lib/utils"78export const DirectionAwareHover = ({9 imageUrl,10 children,11 childrenClassName,12 imageClassName,13 className,14}: {15 imageUrl: string16 children: React.ReactNode | string17 childrenClassName?: string18 imageClassName?: string19 className?: string20}) => {21 const ref = useRef<HTMLDivElement>(null)2223 const [direction, setDirection] = useState<24 "top" | "bottom" | "left" | "right" | string25 >("left")2627 const handleMouseEnter = (28 event: React.MouseEvent<HTMLDivElement, MouseEvent>,29 ) => {30 if (!ref.current) return3132 const direction = getDirection(event, ref.current)33 console.log("direction", direction)34 switch (direction) {35 case 0:36 setDirection("top")37 break38 case 1:39 setDirection("right")40 break41 case 2:42 setDirection("bottom")43 break44 case 3:45 setDirection("left")46 break47 default:48 setDirection("left")49 break50 }51 }5253 const getDirection = (54 ev: React.MouseEvent<HTMLDivElement, MouseEvent>,55 obj: HTMLElement,56 ) => {57 const { width: w, height: h, left, top } = obj.getBoundingClientRect()58 const x = ev.clientX - left - (w / 2) * (w > h ? h / w : 1)59 const y = ev.clientY - top - (h / 2) * (h > w ? w / h : 1)60 const d = Math.round(Math.atan2(y, x) / 1.57079633 + 5) % 461 return d62 }6364 return (65 <motion.div66 onMouseEnter={handleMouseEnter}67 ref={ref}68 className={cn(69 "group/card relative h-60 w-60 overflow-hidden rounded-lg bg-transparent md:h-96 md:w-96",70 className,71 )}72 >73 <AnimatePresence mode="wait">74 <motion.div75 className="relative h-full w-full"76 initial="initial"77 whileHover={direction}78 exit="exit"79 >80 <motion.div className="absolute inset-0 z-10 hidden h-full w-full bg-black/40 transition duration-500 group-hover/card:block" />81 <motion.div82 variants={variants}83 className="relative h-full w-full bg-gray-50 dark:bg-black"84 transition={{85 duration: 0.2,86 ease: "easeOut",87 }}88 >89 <img90 alt="image"91 className={cn(92 "h-full w-full scale-[1.15] object-cover",93 imageClassName,94 )}95// … truncated
What it pulls in
npm packages
