Shimmer
The shimmer sweeps a soft highlight across text, signaling that something is in progress. Use it for thinking indicators, streaming status lines, and anywhere a spinner would be too loud; in chat it pairs with the marker component.
Usage
Add the shimmer class to any text element.
<span class="shimmer">Thinking...</span>Examples
Marker
Compose shimmer with a marker for chat status lines.
<div class="marker" role="status">
<span class="marker-icon" aria-hidden="true">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="animate-spin"><path d="M21 12a9 9 0 1 1-6.219-8.56"/></svg>
</span>
<span class="marker-content shimmer">Thinking...</span>
</div>
<div class="marker marker-separator" role="status">
<span class="marker-content shimmer">Reading 4 files</span>
</div>Color
shimmer-color-<color> sets the highlight color: theme colors with an opacity modifier, or any arbitrary value.
Duration
shimmer-duration-<number> sets one sweep's length in milliseconds; the default is 2000.
Spread
shimmer-spread-<number> sets the highlight band's width on the spacing scale. Use an arbitrary length or percentage for one-off values.
Angle
shimmer-angle-<number> tilts the highlight band in degrees; the default is 20.
Reverse
shimmer-reverse sweeps the highlight in the opposite direction.
Play once
shimmer-once plays a single sweep instead of looping. Pair it with shimmer-duration-<number> to control how long the sweep takes.
Disable
shimmer-none turns the effect off, so the text renders normally at a breakpoint or state.
RTL
Add dir="rtl" to any parent element, typically <html>, to render right-to-left. See the RTL guide for details.
<div id="shimmer-rtl-demo" dir="rtl" class="flex w-full flex-col gap-6">
<span class="shimmer text-sm text-muted-foreground" data-i18n="thinking">جارٍ التفكير...</span>
<span class="shimmer font-medium" data-i18n="reading">قراءة 4 ملفات</span>
</div>
<script>
const translations = {
ar: {
dir: "rtl",
thinking: "جارٍ التفكير...",
reading: "قراءة 4 ملفات",
},
he: {
dir: "rtl",
thinking: "חושב...",
reading: "קורא 4 קבצים",
},
en: {
dir: "ltr",
thinking: "Thinking...",
reading: "Reading 4 files",
},
};
window.addEventListener("message", (e) => {
const t = translations[e.data?.lang];
if (e.data?.type !== "sp-language" || !t) return;
document.getElementById("shimmer-rtl-demo").dir = t.dir;
document.querySelectorAll("[data-i18n]").forEach((el) => {
el.textContent = t[el.dataset.i18n];
});
});
</script>