Skip to content

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

Quarterly 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…

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.ts
  • styles/
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.ts
  • lib/{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

Props

PropTypeDefaultDescription
colorstringthe accent, which keeps AA contrastHighlight colour, any CSS colour.
children (required)ReactNodeNoneText (and inline icons). Avoid interactive content: it is copied for the highlight layer.
trigger"view" | "hover" | "loop" | "mount""view"When the light sweeps: "view" once, the first time the text scrolls into view (default) "hover" each time a pointer enters it, or keyboard focus reaches the control around it "loop" continuously while on screen (status lines); pauses off screen and in hidden tabs "mount" once, right away.
durationnumber1.6Seconds one sweep takes.
delaynumber0Sets the number of seconds before the first sweep.
repeatDelaynumber1Sets the number of seconds between sweeps when looping.
spreadnumber5Sets the width of the light band, in em.
pausedbooleanfalseStop a looping shimmer.

Keyboard

KeysAction
TabNot focusable: this is text. With "hover", keyboard focus reaching the control around it triggers the sweep too.

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

19 effects pages in all: browse them on All effects.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .