Text shimmer

Free

A band of light that sweeps through live words at an even pace, in grey or in the blue, violet and pink glint, while the words keep their own color.

npx shadcn@latest add https://pixilui.com/r/text-shimmer.json

Preview

A lighter band sweeps through live words at an even pace.
Tone
Live

When to use

Use it when

  • The words of something live: "Searching 12 sources", "Thinking", "Generating your report".
  • A Think or reasoning label, in the color tone.

Use something else when

  • Loading placeholders where nothing is written yet: use a skeleton.
  • Finished text: set live to false and the words are plain again.
  • Decoration: the band means work is happening.

Installation

Terminal
npx shadcn@latest add https://pixilui.com/r/text-shimmer.json

Adds text-shimmer.tsx, and installs clsx and tailwind-merge. The URL works in any app with a components.json, with no registry to add first.

Usage

example.tsx
import { TextShimmer } from "@/components/pixilui/text-shimmer";

<TextShimmer />

The band is sized to the words' own width, so it reads the same on a word and on a long line.

API reference

PropTypeDefault
tone"grey" | "color""grey"grey (the default) or color (blue, violet and pink).
livebooleantrueWhether the work is live. Off, the words are plain text in their own color.

Also takes every native <span> attribute, and a ref.

Keyboard

TabNever takes focus: the shimmer is the words' look.

Accessibility

  • The words are ordinary text, read as they are; the band is paint only.
  • Put the live region on the place that changes, never on the shimmer.
  • Every tone keeps the words' contrast: the band is always lighter than the text, and in dark the live words sit a step down so the band can brighten them.

Motion

  • One sweep takes 3.2s, linear and endless: the band is on the words about 60% of each pass and off them the rest.
  • The sweep pauses while the words are off-screen.
  • While the words swap (a library Swap carrying the class), the band steps aside.
  • Reduced motion: no band, plain text.

PixilUI Pro opens soon. The first 20 licenses are $99.