BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/jolyui/ui/morphing-cursor

morphing-cursor

jolyui-ui/morphing-cursor
FreeComponent

jolyui/ui publishes no description for this item.

Live preview

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

Install it

npx shadcn@latest add https://jolyui.dev/r/morphing-cursor.json

Source

ui/morphing-cursor.tsxjolyui.dev/r/morphing-cursor.json
1"use client";
2
3import type React from "react";
4import { useCallback, useEffect, useRef, useState } from "react";
5import { cn } from "@/lib/utils";
6
7interface MagneticTextProps {
8 text: string;
9 hoverText?: string;
10 className?: string;
11}
12
13export function MagneticText({
14 text = "CREATIVE",
15 hoverText = "EXPLORE",
16 className,
17}: MagneticTextProps) {
18 const containerRef = useRef<HTMLDivElement>(null);
19 const circleRef = useRef<HTMLDivElement>(null);
20 const innerTextRef = useRef<HTMLDivElement>(null);
21 const [isHovered, setIsHovered] = useState(false);
22 const [containerSize, setContainerSize] = useState({ width: 0, height: 0 });
23
24 const mousePos = useRef({ x: 0, y: 0 });
25 const currentPos = useRef({ x: 0, y: 0 });
26 const animationFrameRef = useRef<number | undefined>(undefined);
27
28 useEffect(() => {
29 const updateSize = () => {
30 if (containerRef.current) {
31 setContainerSize({
32 width: containerRef.current.offsetWidth,
33 height: containerRef.current.offsetHeight,
34 });
35 }
36 };
37 updateSize();
38 window.addEventListener("resize", updateSize);
39 return () => window.removeEventListener("resize", updateSize);
40 }, []);
41
42 useEffect(() => {
43 const lerp = (start: number, end: number, factor: number) =>
44 start + (end - start) * factor;
45
46 const animate = () => {
47 currentPos.current.x = lerp(
48 currentPos.current.x,
49 mousePos.current.x,
50 0.15,
51 );
52 currentPos.current.y = lerp(
53 currentPos.current.y,
54 mousePos.current.y,
55 0.15,
56 );
57
58 if (circleRef.current) {
59 circleRef.current.style.transform = `translate(${currentPos.current.x}px, ${currentPos.current.y}px) translate(-50%, -50%)`;
60 }
61
62 if (innerTextRef.current) {
63 innerTextRef.current.style.transform = `translate(${-currentPos.current.x}px, ${-currentPos.current.y}px)`;
64 }
65
66 animationFrameRef.current = requestAnimationFrame(animate);
67 };
68
69 animationFrameRef.current = requestAnimationFrame(animate);
70 return () => {
71 if (animationFrameRef.current)
72 cancelAnimationFrame(animationFrameRef.current);
73 };
74 }, []);
75
76 const handleMouseMove = useCallback((e: React.MouseEvent<HTMLDivElement>) => {
77 if (!containerRef.current) return;
78 const rect = containerRef.current.getBoundingClientRect();
79 mousePos.current = {
80 x: e.clientX - rect.left,
81 y: e.clientY - rect.top,
82 };
83 }, []);
84
85// … truncated

Files it writes

  • ui/morphing-cursor.tsx

Facts

Registry
jolyui/ui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-02
Last confirmed
today

Go to the source

Docs on jolyui/ui jolyui.dev Johuniq/jolyui on GitHub Raw registry item This item as JSON

More from jolyui/ui

All 199 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
ai-prompt-boxai-prompt-boxjolyui/uiComponentsFree4 deps
animated-beamanimated-beamjolyui/uiComponentsFree1 dep
animated-tableanimated-tablejolyui/uiComponentsFree2 deps
animated-theme-toggleanimated-theme-togglejolyui/uiComponentsFree2 deps
animated-toastanimated-toastjolyui/uiComponentsFree2 deps
animated-tooltipanimated-tooltipjolyui/uiComponentsFree1 dep
bento-gridbento-gridjolyui/uiComponentsFreeno deps
buttonbuttonjolyui/uiComponentsFree3 deps
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