UI.MD

Shimmering Text

Animated text with a gradient shimmer effect powered by Motion.

Installation

$
npx shadcn@latest add https://ui.mattdowney.com/r/shimmering-text.json

Usage

import { ShimmeringText } from "@/components/ui/shimmering-text"

Examples

Default

Shimmering Text

API Reference

PropTypeDefaultDescription
text*string-The text to render with the shimmer effect.
durationnumber2Duration of one shimmer sweep in seconds.
delaynumber0Delay before the animation starts, in seconds.
repeatbooleantrueWhether the shimmer sweep loops indefinitely.
repeatDelaynumber0.3Pause between repeated sweeps, in seconds.
startOnViewbooleantrueStarts the animation only once the text enters the viewport. Set false to animate immediately.
oncebooleanfalseWhen true, in-view detection fires only the first time the text enters the viewport.
inViewMarginstring-Margin (rootMargin) for in-view detection, e.g. "-100px".
spreadnumber3Shimmer band width multiplier, scaled by text length to size the highlight.
colorstring-Base (resting) text color. Defaults to a dimmed --muted-foreground mix.
shimmerColorstring`var(--foreground)`Color of the bright shimmer band that sweeps across the text.