Gradient Text
Flowing gradient or shine sweep text, optionally inside a solid or glass pill badge.
pnpm dlx @glinui/cli@latest add gradient-textDesign systems that ship themselves
Sync tokens from Figma, open a pull request with the diff and publish a versioned package, all from one workflow.
Installation
pnpm dlx @glinui/cli@latest add gradient-textCredits. Adapted from Magic UI (MIT, (c) Magic UI). Merged gradient and shine variants, token colors, glass badge surface, forced colors fallback and reduced motion levels. Attribution details.
Prefer the package?
Usage
Improvements: colors come from tokens, the badge wrapper ships with solid and glass surfaces, forced-colors fallback, and the sweep is a Web Animations API loop with no global keyframes. Not to be confused with Animated Gradient, which is a background.
Effects and badges
Flow and shine effects, custom colors, and badge surfaces.
import { GradientText } from "@glinui/ui"
export function GradientVariants() { return ( <div data-glin-theme="dark" className="flex w-full flex-col items-center gap-4 rounded-xl bg-[var(--surface-0)] p-8"> <GradientText className="text-4xl font-semibold">Flow effect</GradientText> <GradientText effect="shine" className="text-4xl font-semibold">Shine effect</GradientText> <GradientText from="#38bdf8" to="#a78bfa" className="text-4xl font-semibold">Custom colors</GradientText> <div className="flex flex-wrap items-center justify-center gap-3"> <GradientText badge>Badge</GradientText> <GradientText badge variant="outline">Outline badge</GradientText> <GradientText badge variant="glass">Glass badge</GradientText> </div> </div> )}Accessibility
- Plain inline text, fully selectable and readable.
- Under forced colors (Windows high contrast) the clip gradient is dropped and the text uses CanvasText, so it never disappears.
- Keep contrast in mind: pick from and to colors that pass 3:1 against the background for large text.
Reduced Motion
With prefers-reduced-motion or motion level none or subtle, the gradient is rendered static, with no sweep.
Affected properties
background-position sweepAPI Reference
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
effect | "flow" | "shine" | No | flow | Looping two color gradient, or a glint sweeping over muted text. |
badge | boolean | No | false | Wrap the text in a pill. |
variant | SurfaceVariant | "default" | No | default | Pill surface when badge is set. `glass` uses backdrop blur and glass tokens. |
from | string | No | var(--color-accent) | Gradient start (flow) or text color (shine). |
to | string | No | var(--color-signal-ok) | Gradient end (flow) or glint color (shine). |
speed | number | No | 1 | Animation speed multiplier. 0 holds the gradient still. |
Source
Import directly from the package or browse the source on GitHub. Click any file to view it.
Import
import { GradientText } from "@glinui/ui"Dependencies
@glinui/ui@glinui/motionclass-variance-authorityGenerated API Snapshot
Beta
Generated API Snapshot
BetaAuto-extracted from TypeScript source in packages/ui/src/components/gradient-text.tsx. This section is in beta and may lag behind hand-curated docs. Regenerate with pnpm --filter @glinui/docs api:generate.
Generated: 2026-10-08T01:41:21.546Z · Full index: /docs/api-metadata
Primary Props Type
GradientTextProps
GradientTextProps
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
badge | boolean | No | false | Wrap the text in a pill badge. `variant` styles the pill surface. |
effect | "flow" | "shine" | No | "flow" | `flow` slides a looping two color gradient, `shine` sweeps a glint over muted text. |
from | string | No | - | Gradient start color (flow) or text color (shine). Any CSS color, defaults to Glin tokens. |
speed | number | No | 1 | Animation speed multiplier. 1 is a 6 second loop for flow, 3 seconds for shine. |
to | string | No | - | Gradient end color (flow) or glint color (shine). |
variant | SurfaceVariant | "default" | No | - | Badge surface (with `badge`). Omit for the ambient design style (glinr by default). Vocabulary: glinr, solid, plain, soft, outline, ghost, gradient, glass. |