Glin UI
Primitive / AtomAdapted from Magic UIbeta

Gradient Text

Flowing gradient or shine sweep text, optionally inside a solid or glass pill badge.

Edit on GitHub
Now in public beta

Design 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

Install from
pnpm dlx @glinui/cli@latest add gradient-text

Credits. 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.

Flow effectShine effectCustom colors
BadgeOutline badgeGlass badge
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 sweep

API Reference

PropTypeRequiredDefaultDescription
effect"flow" | "shine"NoflowLooping two color gradient, or a glint sweeping over muted text.
badgebooleanNofalseWrap the text in a pill.
variantSurfaceVariant | "default"NodefaultPill surface when badge is set. `glass` uses backdrop blur and glass tokens.
fromstringNovar(--color-accent)Gradient start (flow) or text color (shine).
tostringNovar(--color-signal-ok)Gradient end (flow) or glint color (shine).
speednumberNo1Animation 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-authority

Generated API Snapshot

Beta

Auto-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

PropTypeRequiredDefaultDescription
badgebooleanNofalseWrap 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.
fromstringNo-Gradient start color (flow) or text color (shine). Any CSS color, defaults to Glin tokens.
speednumberNo1Animation speed multiplier. 1 is a 6 second loop for flow, 3 seconds for shine.
tostringNo-Gradient end color (flow) or glint color (shine).
variantSurfaceVariant | "default"No-Badge surface (with `badge`). Omit for the ambient design style (glinr by default). Vocabulary: glinr, solid, plain, soft, outline, ghost, gradient, glass.