Gradient Text

Text filled with a gradient that sweeps slowly across it.

<script setup lang="ts">
import { GradientText } from '@animate-ui/vue/primitives/texts/gradient'

withDefaults(defineProps<{ neon?: boolean | string }>(), { neon: false })
</script>

<template>
  <GradientText
    class="text-4xl font-semibold"
    text="Gradient Text"
    :neon="neon === true || neon === 'true'"
  />
</template>

Installation

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

Usage

<script setup lang="ts">
import { GradientText } from '@animate-ui/vue/primitives/texts/gradient';
</script>

<template>
  <GradientText text="Gradient Text" neon />
</template>

Animation

  • The gradient sweeps across the text in a 50s linear loop, driven by one motion value: no Vue 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?
HTMLAttributes-

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

Last updated: 10/23/2026