Text filled with a gradient that sweeps slowly across it.
Installation
Install the packages
npm install @prequelui/react motion@prequelui/react reuses the primitive library your components already depend on.
Add the component
npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/gradient-text.jsonnpx shadcn@latest add https://animate.prequelui.terravidhal.me/r/gradient-text.json
Turn on the motion
npx @prequelui/cli@latest animate gradient-textThe CLI finds the component through components.json, swaps the import and removes the CSS animation classes that Motion replaces.
Usage
Import the component and compose it exactly like the primitive it wraps. Motion is enabled by default; the tempo prop scales every duration and softens every spring.
import { GradientText } from "@/components/prequelui/gradient-text";
export default function Demo() {
return (
<GradientText
text="A gradient that keeps moving"
neon
className="text-4xl font-medium"
/>
);
}import { GradientText } from "@/components/prequelui/gradient-text";
export function Variant() {
return (
<GradientText tempo={1.2}>
…
</GradientText>
);
}Animation
The text is painted by a gradient three times wider than the word. The background position travels from the first stop to the far end over fifty seconds, so the colour drift is slow enough to read through.
- Loop: 50 s linear, background position 0% → 500%.
- The loop pauses when the element leaves the viewport or the tab is hidden.
- The neon layer repeats the gradient with an 8 px blur and plus-lighter blending.
- Reduced motion freezes the gradient at its first frame.
API Reference
Each part accepts the usual HTML props in addition to the motion props below. No accessibility prop is hidden behind the animation layer.
GradientText
| Prop | Type | Default |
|---|---|---|
| text | string | — |
| gradient | string | blue → violet → pink |
| neon | boolean | false |
| transition | Transition | component spring or tween |
| className | string | — |