Skip to Content
NarakUI

Text Shimmer

A highlight that sweeps across a label while the work it describes is in progress.

Default

The text renders in the tertiary text color with a primary-colored highlight moving across it. It inherits its size from the parent, so set typography with className. children must be a string. When reduced motion is enabled, the sweep pauses and the label stays legible in the secondary text color.

Searching answer engines

In a row

Use Text Shimmer for the step that is running and plain text once it finishes. It has 4px of vertical padding by default; pass py-0 when it takes the place of text in a row, so the row keeps its height. It also truncates like normal text when you add truncate and a max width.

Read 12 citations
Compared Acme with 4 competitors
Drafting the visibility summary for the weekly report

Duration and spread

duration is the length of one sweep in seconds. spread sets the width of the highlight, in pixels per character, so longer labels get a wider highlight.

DefaultGenerating promptsSlower sweepGenerating promptsWider highlightGenerating prompts

Installation

pnpm dlx shadcn@latest add @narakui/text-shimmer

Add "@narakui": "https://ui.narakcode.dev/r/{name}.json" to components.json, or install directly from https://ui.narakcode.dev/r/text-shimmer.json.

Usage

import { TextShimmer } from '@/components/ui/text-shimmer';

{isRunning ? (
  <TextShimmer className="py-0 text-body-small-medium">{label}</TextShimmer>
) : (
  <span className="text-body-small-medium">{label}</span>
)}

Properties

PropTypeDefaultDescription
children (Required)string—The label to animate
durationnumber1Length of one sweep, in seconds
spreadnumber2Width of the highlight, in pixels per character of the label
classNamestring—Additional CSS classes, such as typography or py-0