Pools of colour swirl and flow inside the letters, for headings that feel alive without moving an inch.
Headline text with a slowly flowing, seamlessly looping gradient.
Think beyond ordinary.
Customize
Usage
import { GradientText } from "@/components/motionkit/gradient-text";
<GradientText
as="h1"
className="text-5xl font-semibold"
>
Think beyond ordinary.
</GradientText>Motion
The exact curves this component runs, plotted with Motion's own maths.
Colour flow
Runs on its own
One standout word or phrase in a headline, such as the product name or the promise, rather than whole paragraphs.
The text uses background-clip: text, so a wide linear gradient shows through the letters. The first colour is repeated at the end, which lets Motion slide background-position from 0% to 200% on a linear loop with no visible seam.
Works in the App Router as is. Requires Tailwind CSS v4.
One command adds the file and installs its dependencies. Needs a components.json (run npx shadcn@latest init once if you don't have one).
npx shadcn@latest add https://www.motionkitui.com/r/gradient-text.jsonnpm install motionSave as components/motionkit/gradient-text.tsx.
"use client";
import type { ElementType, ReactNode } from "react";
import { motion, useReducedMotion } from "motion/react";
type GradientTextProps = {
children: ReactNode;
/** Gradient stops, left to right. The first color is repeated to make the loop seamless. */
colors?: string[];
/** Seconds per full loop. */
duration?: number;
/** Wrapping element, e.g. "h1". */
as?: ElementType;
className?: string;
};
export function GradientText({
children,
colors = ["#9FD8DC", "#B9C7FF", "#D6A7CE"],
duration = 6,
as: Tag = "span",
className = "",
}: GradientTextProps) {
const reduceMotion = useReducedMotion();
return (
<Tag className={className}>
<motion.span
className="bg-clip-text text-transparent [background-size:200%_auto] [box-decoration-break:clone]"
style={{ backgroundImage: `linear-gradient(90deg, ${[...colors, colors[0]].join(", ")})` }}
animate={reduceMotion ? undefined : { backgroundPosition: ["0% 50%", "200% 50%"] }}
transition={{ duration, repeat: Infinity, ease: "linear" }}
>
{children}
</motion.span>
</Tag>
);
}
| Prop | Type | Default | Description |
|---|---|---|---|
| colors | string[] | ["#5FAEB4", "#E4DCCF", "#A56D5B"] | Gradient stops, left to right. |
| duration | number | 6 | Seconds per full loop. |
| as | ElementType | "span" | Wrapping element, e.g. "h1". |
How we audit: the WCAG 2.2 animation checklist and respecting reduced motion in React.
Yes. The file starts with "use client", so you can import it straight into a Server Component page or layout. It works in Vite as is, and in Astro as a React island.
Only the motion package, beside React and Tailwind CSS v4. There is no MotionKit package and no Tailwind config to add.
Yes. Run npx shadcn@latest add https://www.motionkitui.com/r/gradient-text.json in any project with a components.json. It saves the file to components/motionkit and installs its dependencies.
The gradient holds still for reduced-motion users. It loops forever otherwise, so if it sits beside other content for more than 5 seconds, WCAG 2.2.2 asks you to add a pause control.
Pools of colour swirl and flow inside the letters, for headings that feel alive without moving an inch.
A narrow glint of light sweeps across the letters every few seconds, like light catching metal.
Types a phrase, pauses, backspaces and types the next, with a human rhythm and a caret that blinks only at rest.