Shimmer Text
A band of light that sweeps across real, selectable text.
Overview
Shimmer Text sweeps a band of light across its text. While it sweeps, the text dims slightly so the band reads clearly, then the band leaves and pauses before the next pass.
The text stays real HTML text drawn with CSS, not a canvas: it is selectable, crisp at any size, translated by the browser, and read by assistive technology. Colors default to currentColor, so it follows the surrounding text color in light and dark themes.
Use it on a launch heading, or on a status line while an assistant is thinking. Set active to false when the work is done and the text returns to full color.
Installation
Usage
import { ShimmerText } from "honestui/shaders"
<h1 className="text-5xl font-semibold tracking-tight">
<ShimmerText>Ideas, made real.</ShimmerText>
</h1>Signaling work in progress
<p role="status" className="text-sm text-muted-foreground">
<ShimmerText active={isThinking}>
{isThinking ? "Thinking…" : "Done"}
</ShimmerText>
</p>The sweep is a visual cue only. Put the state in the words themselves, as above, and use a live region such as role="status" when the change should be announced.
Colors
color is the text color and shimmerColor the band. Both accept any CSS color, including custom properties.
<ShimmerText color="var(--muted-foreground)" shimmerColor="var(--foreground)" dim={0}>
Generating summary
</ShimmerText>Wrap the text inside a heading rather than rendering the heading itself with as when the heading is wider than its text, such as a centered heading. The band crosses the element's whole box, so a wide box spends more of each pass on empty space.
Accessibility
The text is ordinary text in the document, so its accessible name, language, and selection behave normally. While sweeping, the text is drawn at reduced strength set by dim; check its contrast at that strength against the background, and lower dim for body-size text.
When the user prefers reduced motion, the band does not move and the text is shown at full color.