Shimmer

Generating response… A highlight that sweeps across text while something is on its way.

Demo

Generating response…

Installation

shimmer comes with @kappa-ui/core/tailwind.css, which the tokens item imports; there is no separate item.

Usage

<p class="shimmer text-muted-foreground">Generating response…</p>

The text is painted through a gradient with background-clip: text, and the highlight sweeps across it in a loop. The highlight comes from the text's own colour, so it works on text-muted-foreground and on brand colours alike, and it brightens in dark mode to stay visible. Ported from shadcn-vue's utility of the same name.

ClassEffect
shimmerThe sweep, two seconds per pass, looping.
shimmer-onceOne pass instead of a loop.
shimmer-reverseSweeps the other way.
shimmer-nonePlain text again, in any class order.
shimmer-color-<color>The highlight colour: a theme colour, with an optional /<opacity>, or [<value>].
shimmer-duration-<ms>One pass in milliseconds.
shimmer-spread-<n>The band's width on the spacing scale, or [<length>]. calc(3ch + 40px) by default.
shimmer-angle-<deg>The band's tilt in degrees. 20 by default.

Examples

Colour

Colour

Generating response…

Generating response…

Duration, spread and angle

Options

Generating response…

shimmer

Generating response…

shimmer shimmer-duration-1000

Generating response…

shimmer shimmer-spread-24

Generating response…

shimmer shimmer-angle-45

Play once

shimmer-once plays a single pass, a reveal for the moment streaming ends. Change the element's key to play it again.

Once

Generating response…

Turning it off

shimmer-none wins over shimmer whatever the order, so it works from a state or a breakpoint: md:shimmer-none.

None

Generating response…

Motion and direction

With reduced motion the text renders plainly. In right-to-left text the sweep follows the reading direction; shimmer-reverse flips it by hand.

The highlight uses relative colour syntax and color-mix(). A browser without them drops the gradient and can leave the text transparent; to support one, apply the class behind supports-[color:oklch(from_white_l_c_h)]:shimmer.

VariableDefaultDescription
--shimmer-colorthe text colour at 20% alpha; brighter under .darkThe highlight colour. The tokens item sets both defaults.
--shimmer-duration2sOne pass.
--shimmer-spreadcalc(3ch + 40px)The band's half width.
--shimmer-angle20degThe band's tilt.