React Shimmer Text Animation
A shimmer text animation for React: a band of light sweeps across the letters while the real text stays whole and selectable.
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/text-effects.jsonQuarterly report
Building your report
Status line
trigger="loop" for work in progress. It only runs while on screen, and stops with reduced motion.
Which plan fits a team of twelve?
Thinking through your question…
import { Avatar } from "@/components/sheenui/avatar/avatar";
import { GlassCard } from "@/components/sheenui/glass-card/glass-card";
import { ShimmerText } from "@/components/sheenui/text-effects/shimmer-text";
// Package build (after the first npm release, or a packed tarball): import { Avatar, GlassCard, ShimmerText } from "@sheenui/theme";
// This example also uses avatar, glass-card: npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/avatar.json https://lokendra-builds.github.io/sheenui/r/glass-card.json
export function Example() {
return (
<GlassCard className="flex w-full max-w-md flex-col gap-4 p-5">
<p className="ms-auto max-w-[85%] rounded-sheen-lg rounded-ee-sheen-sm bg-sheen-accent-soft px-4 py-2.5 text-sm">
Which plan fits a team of twelve?
</p>
<div className="flex items-center gap-3">
<Avatar name="Sheen Assistant" size="sm" />
<ShimmerText trigger="loop" className="text-sm font-medium text-sheen-fg-muted">
Thinking through your question…
</ShimmerText>
</div>
</GlassCard>
);
}Files to copy
5 folders · 7 files · 4 packages
- From
theme/src/ components/text-effects/{shimmer-text.tsx, text-utils.ts}hooks/{use-media-query.ts, use-preferences.ts}motion/{gate.ts, tokens.ts}lib/cn.tsstyles/
- shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/text-effects.jsonRegistry item: text-effects. The styles need the Tailwind v4 glass UI setup.- The examples also use
components/avatar/components/button/components/glass-card/components/spinner/hooks/{use-latest.ts, use-magnetic.ts}motion/light-follower.tslib/{form.ts, heading.ts, initials.ts, state-light.tsx}
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/avatar.json https://lokendra-builds.github.io/sheenui/r/button.json https://lokendra-builds.github.io/sheenui/r/glass-card.json- Packages
pnpm add @base-ui/react clsx motion tailwind-merge
On view and on hover
The headline sweeps once as it scrolls in. In a link or button, hover (or keyboard focus) anywhere on the control replays it.
Meet the new glassSee what's new
import { Button } from "@/components/sheenui/button/button";
import { ShimmerText } from "@/components/sheenui/text-effects/shimmer-text";
// Package build (after the first npm release, or a packed tarball): import { Button, ShimmerText } from "@sheenui/theme";
import { ArrowRight as ArrowIcon } from "lucide-react";
// This example also uses button: npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/button.json
export function Example() {
return (
<>
<ShimmerText className="text-4xl font-semibold tracking-tight sm:text-5xl">
Meet the new glass
</ShimmerText>
{/* ArrowIcon: any 16px svg icon */}
<Button variant="glass" render={<a href="#changelog" />} trailing={<ArrowIcon />}>
<ShimmerText trigger="hover" duration={1.1}>See what's new</ShimmerText>
</Button>
</>
);
}Props
Keyboard
Accessibility
- The highlight copy is aria-hidden, so the text is read once. The default highlight is the accent, which keeps AA contrast.
- Under reduced motion there is no overlay at all, just the text; in forced colors the overlay is hidden.
When to use the shimmer text effect
- Use it as a text shine effect for a Thinking or Generating your report status line, with trigger="loop" so a band of light keeps sweeping while the work is pending.
- Use it to draw the eye to a badge or announcement link once, with trigger="view" (the default) so the light passes the first time the text scrolls into view.
- Use trigger="hover" inside a link or button so the sweep runs when a pointer enters the control or keyboard focus reaches it, padding included.
- Skip it when you want a text reveal rather than a highlight: BlurIn arrives word by word on a headline, Typewriter types phrases, and neither fits a status that should simply stay readable.
- Pair it with Badge for an announcement pill, Button for a hover-triggered label, and the paused prop plus your own loading state to stop the loop when work finishes.
Frequently asked questions
Related pages
19 effects pages in all: browse them on All effects.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .