Text Shimmer

Animated

A shimmering label for work in progress.

Source
$npx @dinachi/cli@latest add text-shimmer
Thinking…
children
variant
duration
dim

Usage

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

export function Thinking({ pending }: { pending: boolean }) {
  return pending ? <TextShimmer>Thinking…</TextShimmer> : null
}

Examples

Thinking…
A band travelling across a pending label.
import { TextShimmer } from '@/components/ui/text-shimmer';

export function Example() {
  return <TextShimmer className="text-lg">Thinking…</TextShimmer>;
}

Notes

Mounting

It loops while mounted. Mount it when the work starts; unmount it when the work lands.

Variants

  • sweep for label-sized text.
  • pulse for dense or small text. It animates only opacity, so it is cheaper.

Both use currentColor and follow the theme.

Size

sweep animates background-position, which repaints the box every frame. Use it on a label, never a paragraph.

Motion tier

Needs motion. add --all skips it; install with add --motion or by name.

API

variant"sweep" | "pulse" = "sweep"
A highlight band across the text, or the whole label pulsing.
durationnumber = 1.6 sweep, 1.8 pulse
Seconds for one cycle.
dimnumber = 0.7
Brightness of un-lit text, 0 to 1. Keep it readable.

Accessibility

  • The span has role="status".
  • Reduced motion stops the loop; the dim colour remains.