Documentation

Shimmer

A Tailwind CSS utility that sweeps a soft highlight across text, the universal sign for "hang on, I'm working on it".

Preview

Thinking...

Generating a response worth the wait...

Reading 4 files

Usage

Shimmer is a Tailwind utility, not a component, so there's nothing to import. It ships with the shadcn package, which VitNode apps already load in src/styles.css:

@import 'shadcn/tailwind.css';
<p className="shimmer text-muted-foreground">Generating response...</p>

The highlight comes from currentColor, so it works on any text color, and it brightens on its own in dark mode. One sweep takes two seconds, then loops.

Variants

  • Generating response...shimmer
  • Generating response...shimmer-color-success
  • Generating response...shimmer-duration-1000
  • Generating response...shimmer-spread-24
  • Generating response...shimmer-angle-45
  • Generating response...shimmer-reverse
Response generated.shimmer-once
ClassWhat it does
shimmerTurns the effect on
shimmer-color-<color>Highlight color: theme color, /opacity or [#378ADD]
shimmer-duration-<ms>One sweep in milliseconds (default 2000)
shimmer-spread-<number>Band width on the spacing scale, or [30%] (default 3ch + 40px)
shimmer-angle-<number>Band tilt in degrees (default 20)
shimmer-reverseSweeps against the reading direction
shimmer-oncePlays a single sweep
shimmer-noneTurns it off, in any class order

The sweep follows the reading direction, so it runs right to left in RTL.

Play once

shimmer-once makes a nice "done!" when streaming finishes. Change the element's key to replay it.

<p className="shimmer shimmer-once shimmer-duration-1100" key={replays}>
  Response generated.
</p>

Turning it off

shimmer-none wins regardless of class order, so it works with breakpoints and state variants:

<p className="shimmer md:shimmer-none">Generating response...</p>

With a status line

Pair it with a Spinner and a Marker:

<Marker role="status">
  <MarkerIcon>
    <Spinner />
  </MarkerIcon>
  <MarkerContent className="shimmer">Thinking...</MarkerContent>
</Marker>

Browser support

Shimmer needs relative color syntax and color-mix(), which every current browser has. Older ones may render the text transparent. To be safe, apply it only where it works:

<p className="supports-[color:oklch(from_white_l_c_h)]:shimmer">
  Generating response...
</p>

Accessibility

  • Reduced motion stops the animation automatically, but only for the plain shimmer class. Behind a variant (group-hover:shimmer), add motion-reduce:shimmer-none yourself.
  • Shimmer is decoration, not a loading signal. Put real text inside role="status", like "Thinking...".
  • Keep it on short status text. A whole sparkling paragraph is more disco than progress.

Reference

shadcn/ui - shimmer