Shimmer
Generating response… A highlight that sweeps across text while something is on its way.
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.
| Class | Effect |
|---|---|
shimmer | The sweep, two seconds per pass, looping. |
shimmer-once | One pass instead of a loop. |
shimmer-reverse | Sweeps the other way. |
shimmer-none | Plain 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
Generating response…
Generating response…
Duration, spread and angle
Generating response…
shimmerGenerating response…
shimmer shimmer-duration-1000Generating response…
shimmer shimmer-spread-24Generating response…
shimmer shimmer-angle-45Play once
shimmer-once plays a single pass, a reveal for the moment streaming ends. Change the element's key to play it again.
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.
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.
| Variable | Default | Description |
|---|---|---|
| --shimmer-color | the text colour at 20% alpha; brighter under .dark | The highlight colour. The tokens item sets both defaults. |
| --shimmer-duration | 2s | One pass. |
| --shimmer-spread | calc(3ch + 40px) | The band's half width. |
| --shimmer-angle | 20deg | The band's tilt. |