Text filled with a gradient that sweeps slowly across it.
Gradient Text
Installation
Usage
import { GradientText } from '@animate-ui/react/primitives/texts/gradient';
export function Title() {
return <GradientText text="Gradient Text" neon />;
}Animation
- The gradient sweeps across the text in a 50s linear loop, driven by one motion value: no React render per frame.
<AnimateUIProvider tempo>paces the default loop.- The sweep pauses off screen and in a hidden tab, and resumes where it stopped.
- Under reduced motion, the gradient holds still.
neonadds a blurred copy of the text as a glow. It is decorative and hidden from screen readers, which read the text once.
API Reference
GradientText
| Prop | Type | Default |
|---|---|---|
text | string | - |
gradient? | string | 'linear-gradient(90deg, #3b82f6 0%, #a855f7 20%, #ec4899 50%, #a855f7 80%, #3b82f6 100%)' |
neon? | boolean | false |
transition? | Transition | { duration: 50, repeat: Infinity, ease: 'linear' } |
...props? | Omit<React.ComponentProps<'span'>, 'children'> | - |