Gradient Text

Text filled with a gradient that sweeps slowly across it.

Gradient Text
"use client"

import { GradientText } from "@animate-ui/react/primitives/texts/gradient"

export default function GradientTextDemo({ neon = false }: { neon?: boolean }) {
  return (
    <GradientText
      className="text-4xl font-semibold"
      text="Gradient Text"
      neon={neon}
    />
  )
}

Installation

npm install @animate-ui/react motion
pnpm add @animate-ui/react motion
yarn add @animate-ui/react motion
bun add @animate-ui/react motion

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.
  • neon adds 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

PropTypeDefault
text
string-
gradient?
string'linear-gradient(90deg, #3b82f6 0%, #a855f7 20%, #ec4899 50%, #a855f7 80%, #3b82f6 100%)'
neon?
booleanfalse
transition?
Transition{ duration: 50, repeat: Infinity, ease: 'linear' }
...props?
Omit<React.ComponentProps<'span'>, 'children'>-

Built by Skyleen. The source code is available on GitHub.

Last updated: 10/18/2026

On this page