BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/obsidianui/hover-img

hover-img

obsidianui/hover-img
FreeComponent

obsidianui publishes no description for this item.

Live preview

live · rendered by the registry
Rendered by obsidianui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://obsidianui.dev/r/hover-img.json

Source

components/ui/hover-img.tsxobsidianui.dev/r/hover-img.json
1"use client";
2
3import React, { useRef, useEffect } from "react";
4import gsap from "gsap";
5import "./hover-img.css";
6
7interface ProjectItem {
8 title: string;
9 label: string;
10 imageSrc: string;
11}
12
13const defaultProjects: ProjectItem[] = [
14 {
15 title: "Shree Krishna",
16 label: "The Supreme Personality of Godhead",
17 imageSrc: "/hover-img/image-1.jpg",
18 },
19 {
20 title: "Radha Krishna",
21 label: "The Divine Couple",
22 imageSrc: "/hover-img/image-2.jpg",
23 },
24 {
25 title: "Divine Love",
26 label: "Eternal Bond",
27 imageSrc: "/hover-img/image-3.jpg",
28 },
29];
30
31interface HoverImgProps {
32 projects?: ProjectItem[];
33 className?: string;
34 isContained?: boolean; // New prop for grid previews
35 compact?: boolean; // New prop for compact layout
36}
37
38export function HoverImg({ projects = defaultProjects, className, isContained = false, compact = false }: HoverImgProps) {
39 const containerRef = useRef<HTMLDivElement>(null);
40 const thumbnailRef = useRef<HTMLDivElement>(null);
41 const xToRef = useRef<gsap.QuickToFunc | null>(null);
42 const yToRef = useRef<gsap.QuickToFunc | null>(null);
43
44 useEffect(() => {
45 const projectThumbnail = thumbnailRef.current;
46 const projectsContainer = containerRef.current?.querySelector(
47 ".hover-img-projects"
48 ) as HTMLElement | null;
49
50 if (!projectThumbnail || !projectsContainer) return;
51
52 const projectElements = gsap.utils.toArray(
53 ".hover-img-project",
54 projectsContainer
55 ) as HTMLElement[];
56 const thumbnails = gsap.utils.toArray(
57 ".hover-img-thumbnail",
58 projectThumbnail
59 ) as HTMLElement[];
60
61 gsap.set(projectThumbnail, { scale: 0, xPercent: -50, yPercent: -50 });
62
63 xToRef.current = gsap.quickTo(projectThumbnail, "x", {
64 duration: 0.4,
65 ease: "power3.out",
66 });
67 yToRef.current = gsap.quickTo(projectThumbnail, "y", {
68 duration: 0.4,
69 ease: "power3.out",
70 });
71
72 const handleMouseMove = (e: MouseEvent) => {
73 let x = e.clientX;
74 let y = e.clientY;
75
76 if (isContained && containerRef.current) {
77 const rect = containerRef.current.getBoundingClientRect();
78 x = e.clientX - rect.left;
79 y = e.clientY - rect.top;
80 }
81
82 xToRef.current?.(x);
83// … truncated

Files it writes

  • public/r/hover-img.json

Facts

Registry
obsidianui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-01
Last confirmed
3 days ago

Go to the source

Docs on obsidianui obsidianui.dev Atharvsinh-codez/ObsidianUI on GitHub Raw registry item This item as JSON

More from obsidianui

All 111 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
ai-inputai-inputobsidianuiComponentsFree2 deps
alertalertobsidianuiComponentsFreeno deps
animated-tab-baranimated-tab-barobsidianuiComponentsFreeno deps
apple-spotlightapple-spotlightobsidianuiComponentsFree2 deps
avataravatarobsidianuiComponentsFree1 dep
badgebadgeobsidianuiComponentsFree1 dep
breadcrumbbreadcrumbobsidianuiComponentsFree2 deps
buttonbuttonobsidianuiComponentsFree1 dep
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex