Text Shimmer

TextShimmer renders text with an animated, moving highlight that sweeps across the glyphs using a background-clip gradient. It is intended for loading and in-progress states, such as AI 'thinking' indicators, or for drawing attention to a line of text.

uiaiprompt-kitregistry-item.json
Text Shimmer
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add @prompt-kit/text-shimmer

Requires @prompt-kit in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { TextShimmer } from "@/components/prompt-kit/text-shimmer"export function Example() {  return <TextShimmer>Thinking...</TextShimmer>}
  • Showing a loading or in-progress state for AI responses, such as 'Thinking...' or 'Generating...'.
  • Highlighting a short line of text, like a status message or a call to action, without adding an icon or badge.
  • Replacing a spinner next to a label when a text-only indicator fits the layout better.
  • Rendering a heading or paragraph with a shimmer effect by changing the element through the as prop.

Examples

Loading status text

A small inline status message shown while a response is generated.

loading-status-text.tsx
import { TextShimmer } from "@/components/prompt-kit/text-shimmer"export function LoadingStatus() {  return (    <TextShimmer className="text-sm">Generating response...</TextShimmer>  )}

Paragraph with custom speed and width

Renders a <p> element with a 2 second cycle and a wider highlight band.

paragraph-with-custom-speed-and-width.tsx
import { TextShimmer } from "@/components/prompt-kit/text-shimmer"export function AnalyzingNotice() {  return (    <TextShimmer as="p" duration={2} spread={30} className="text-lg">      Analyzing your prompt    </TextShimmer>  )}

Heading highlight

Uses as="h2" to keep semantic heading markup while applying the shimmer.

heading-highlight.tsx
import { TextShimmer } from "@/components/prompt-kit/text-shimmer"export function SectionTitle() {  return (    <TextShimmer as="h2" className="text-3xl font-bold">      Getting things ready    </TextShimmer>  )}

Chat thinking indicator with live region

Wraps the shimmer in a polite live region so screen readers announce the status once.

chat-thinking-indicator-with-live-region.tsx
import { TextShimmer } from "@/components/prompt-kit/text-shimmer"export function ThinkingIndicator() {  return (    <div role="status" aria-live="polite">      <TextShimmer>Thinking</TextShimmer>    </div>  )}

API reference

PropTypeDefaultDescription
asstring"span"The HTML element tag to render, cast to React.ElementType internally (for example "p", "h2", or "div").
childrenReact.ReactNode—The text or content to display with the shimmer effect. Required.
durationnumber4Length of one shimmer cycle in seconds. Applied as an inline animationDuration, which overrides the 4s value in the class name.
spreadnumber20Width of the highlight band. The value is clamped to the range 5 to 45 and used to position the gradient color stops around 50%.
classNamestring—Additional Tailwind classes merged with the component's base classes via cn(). Use it for font size, color, and layout.
...propsReact.HTMLAttributes<HTMLElement>—Any other HTML attributes, such as id, role, aria-live, or data-*, are spread onto the rendered element. Passing a style prop replaces the component's inline gradient and duration styles, so avoid it unless you intend that.

Accessibility

  • The shimmer is purely visual. The text is real DOM text, so screen readers read it normally; no extra label is needed.
  • For status updates that appear dynamically, wrap the component in an element with role="status" and aria-live="polite" so the change is announced once, not repeatedly.
  • The animation moves continuously. Respect reduced-motion preferences by adding a motion-reduce variant (for example, className="motion-reduce:animate-none") to disable the sweep for users who request less motion.
  • Contrast depends on the theme tokens: the muted-foreground band is lower contrast than foreground. Keep the text short or use a size that remains readable at the dimmest point of the sweep.
  • Choose the as prop to match document structure, such as h2 for headings or p for paragraphs, so the semantic outline stays correct.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Text Shimmer" component (prompt-kit/text-shimmer) from its shadcn registry.1. Install it with: npx shadcn@latest add @prompt-kit/text-shimmer2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: as, children, duration, spread, className, ...props.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { TextShimmer } from "@/components/prompt-kit/text-shimmer"export function Example() {  return <TextShimmer>Thinking...</TextShimmer>}```

Files & dependencies

  • components/prompt-kit/text-shimmer.tsx

Looks similar, elsewhere