BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/ncdai/fluid-gradient-text

Fluid Gradient Text

ncdai/fluid-gradient-text
UnverifiedComponent

Render text with a fluid gradient that shifts with pointer movement.

Install it

npx shadcn@latest add https://raw.githubusercontent.com/srirae/iamsri/main/public/r/fluid-gradient-text.json

Source

src/registry/components/fluid-gradient-text/fluid-gradient-text.tsxraw.githubusercontent.com/srirae/iamsri/main/public/r/fluid-gradient-text.json
1"use client"
2
3import { motion, useMotionValue, useSpring, useTransform } from "motion/react"
4
5export type FluidGradientTextProps = {
6 /** Text content rendered inside the SVG. */
7 text: string
8 /**
9 * SVG viewBox width used to scale the gradient and text layout.
10 * @default 1200
11 * */
12 svgViewBoxWidth?: number
13 /**
14 * SVG viewBox height used as the base text size.
15 * @default 300
16 * */
17 svgViewBoxHeight?: number
18}
19
20export function FluidGradientText({
21 text,
22 svgViewBoxWidth = 1200,
23 svgViewBoxHeight = 300,
24}: FluidGradientTextProps) {
25 const gradientX1Raw = useMotionValue(0.5)
26 const gradientX1 = useSpring(
27 useTransform(gradientX1Raw, [0, 1], [0, svgViewBoxWidth]),
28 {
29 stiffness: 150,
30 damping: 25,
31 }
32 )
33
34 const handleMouseMove = (event: React.MouseEvent<HTMLDivElement>) => {
35 const containerRect = event.currentTarget.getBoundingClientRect()
36 gradientX1Raw.set(
37 (event.clientX - containerRect.left) / containerRect.width
38 )
39 }
40
41 const handleMouseLeave = () => {
42 gradientX1Raw.set(0.5)
43 }
44
45 return (
46 <div
47 className="relative size-full overflow-hidden after:absolute after:bottom-0 after:h-px after:w-full after:bg-current/15"
48 onMouseMove={handleMouseMove}
49 onMouseLeave={handleMouseLeave}
50 >
51 <svg
52 className="size-full translate-y-[37.5%] select-none"
53 viewBox={`0 0 ${svgViewBoxWidth} ${svgViewBoxHeight}`}
54 fill="none"
55 xmlns="http://www.w3.org/2000/svg"
56 >
57 <text
58 x="50%"
59 y="50%"
60 textAnchor="middle"
61 dominantBaseline="central"
62 stroke="currentColor"
63 strokeOpacity="0.1"
64 strokeWidth="2"
65 fill="url(#fluid_gradient_text_linear)"
66 style={{
67 fontFamily: "Helvetica",
68 fontSize: svgViewBoxHeight,
69 fontWeight: "bold",
70 }}
71 >
72 {text}
73 </text>
74 <defs>
75 <motion.linearGradient
76 id="fluid_gradient_text_linear"
77 x1={gradientX1}
78 y1="0"
79 x2={svgViewBoxWidth / 2}
80 y2={svgViewBoxHeight}
81 gradientUnits="userSpaceOnUse"
82 >
83 <stop offset="0.625" stopColor="currentColor" stopOpacity="0" />
84 <stop offset="1" stopColor="currentColor" />
85 </motion.linearGradient>
86 </defs>
87 </svg>
88 </div>
89 )
90}

What it pulls in

npm packages

  • motion

Files it writes

  • src/registry/components/fluid-gradient-text/fluid-gradient-text.tsx

Facts

Registry
ncdai
Type
registry:component
Access
Unverified
Files written
1
Licence
MIT
First indexed
2026-08-04
Last confirmed
today

Go to the source

chanhdai.com Sumeet011/Portfolio on GitHub Raw registry item This item as JSON

More from ncdai

All 48 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Apple Hello Effectapple-hello-effectncdaiComponentsUnverified1 dep
Apple Hello Effect - Hindiapple-hello-effect-hindincdaiComponentsUnverified1 dep
Apple Hello Effect - Spanishapple-hello-effect-spanishncdaiComponentsUnverified1 dep
Apple Hello Effect - Vietnameseapple-hello-effect-vietnamesencdaiComponentsUnverified1 dep
Brand Assets Menubrand-assets-menuncdaiComponentsUnverified1 dep
chevrons-up-down-iconchevrons-up-down-iconncdaiComponentsUnverified1 dep
Code Block Commandcode-block-commandncdaiComponentsUnverified4 deps · 2 files
Consent Managerconsent-managerncdaiComponentsUnverified1 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