Shimmer
Words that say work is under way, with light passing over them.
On this page
A shimmer is a line of words that says work is under way: "Thinking", "Searching 14 files", "Deploying". The words rest at a little over half the ink of the text around them and a band of that ink in full passes over the letters, so the line brightens where the light is and never changes hue. Put shimmer on the element that holds the words.
Shimmer
<p class="shimmer text-sm" role="status">Thinking…</p><p class="shimmer text-sm" role="status">Searching 14 files for “corner-shape”</p>#Words, not a placeholder
A skeleton stands for content whose shape is known and whose words are not. A spinner says something is happening and nothing else. A shimmer is for the case in between: you can say what is happening, in words, and the words are the status.
The light is a background clipped to the text. The words stay real text: they can be selected, copied, translated and read aloud. The box shrinks to the width of the words, so the light crosses the words and not the empty room beside them.
#With other parts
The class sets no size and no weight, so the line takes the type of the place it stands in: a turn of a conversation that has not arrived yet, a step that is running, a title while its page loads.
In a conversation and in a list
<div class="flex flex-col"> <div class="message message-sent"> <div class="message-bubble">What changed in the last release?</div> </div> <div class="message"> <div class="message-bubble"> <span class="shimmer" role="status">Reading the changelog…</span> </div> </div></div><ol class="steps steps-vertical"> <li class="steps-item"> <div class="steps-body"> <p class="steps-title">Install dependencies</p> </div> </li> <li class="steps-item" aria-current="step"> <div class="steps-body"> <p class="steps-title shimmer">Building 212 pages</p> </div> </li> <li class="steps-item"> <div class="steps-body"> <p class="steps-title">Deploy</p> </div> </li></ol>#Tuning
--shimmer-duration is the time of one pass, two seconds by default; a long sentence can take three. --shimmer-color is the ink of the words at rest and --shimmer-light the ink of the band; both are mixed from the current color, so the line reads on a page, in a card and on the ink of a sent message alike.
With prefers-reduced-motion: reduce the band is removed and the line rests in its quieter ink. Its words still say what is happening.
#Accessibility
- Give the line
role="status"when it appears or changes while the reader is on the page, so the words are announced. One status region per task is enough. - Replace the line with its result; do not leave a shimmer running beside content that has arrived.
- The effect is decoration. Everything it means is in the words.
#Classes
| Class | Description |
|---|---|
shimmer | Words in a quieter ink with a band of light passing over them; goes on the element that holds the words |
#Custom properties
| Property | Default | Description |
|---|---|---|
--shimmer-duration | 2s | Time of one pass |
--shimmer-color | color-mix(in oklab, currentColor 56%, transparent) | Ink of the words at rest |
--shimmer-light | currentColor | Ink of the band |
#Related
- SkeletonThe shape of content that is on its way.
- SpinnerA fine ring for work of unknown duration.
- MessageOne turn of a conversation, as a bubble that points at its author.