# Text Shimmer (Lumen Halo): prompt.md (v1.0.0)

- id: `lumen-text-shimmer` · version 1.0.0 · component · free
- category: Text & motion
- build: Base UI (one set of files; its dependencies follow the build)
- install (this build): `npx shadcn@latest add https://beautiful-ui.dev/r/lumen-text-shimmer.json`
- npm dependencies: none
- registry dependencies: utils, https://beautiful-ui.dev/r/lumen-foundation.json
- docs: https://beautiful-ui.dev/components/lumen-text-shimmer
- The install command carries everything this item needs (files, CSS, tokens, npm and registry dependencies). Prefer it to copying source by hand.

Work in progress, said in text: a narrow band of light passes across muted words, slow enough to read as waiting, and the words settle to full ink when the work is done.

## Build it
- Stack: React 19 (`ref` is a plain prop), TypeScript, Tailwind CSS v4 utilities, a shadcn-initialised project with the `@/*` alias.
- Packages: none beyond React.
- Files: `components/ui/lumen/controls/text-shimmer.tsx`.
- Registry dependencies, installed with it automatically: shadcn `utils` (cn), `lumen-foundation`.
- Builds: one set of files for both, but its dependencies come in Base UI and Radix builds. Install the one that matches the project (see Install): a free item's bare URL installs the Base UI build of it and its dependencies.
- Exports to keep: `TextShimmer`, and every exported type.
- CSS: the install merges this item's rules (the registry `css` field) into your global stylesheet, in `@layer components`, and adds the lumen foundation (tokens, keyframes, motion levels) once. Nothing to import by hand.
- Re-running `add` (or `--overwrite`) re-applies those rules: put overrides in your own CSS, never in the installed rules.
- Tokens: retheme with the `--lumen-*` custom properties (`--lumen-accent`, `--lumen-accent-foreground`, `--lumen-accent-text`, `--lumen-bad`, `--lumen-bad-text`, `--lumen-chart-accent`, `--lumen-chart-accent-foreground`, `--lumen-chart-accent-text`, `--lumen-focus`, `--lumen-good`, `--lumen-good-text`, `--lumen-hairline`, `--lumen-ink`, `--lumen-muted-ink`, `--lumen-series-1`, `--lumen-series-2`, `--lumen-series-3`, `--lumen-series-4`, `--lumen-series-5`, `--lumen-series-6`, `--lumen-warn`, `--lumen-warn-text`). Never add Tailwind colour classes inside the component.

```tsx
import { TextShimmer } from "@/components/ui/lumen/controls/text-shimmer";
```

## Parts

| Part | data-slot | What it is for |
|---|---|---|
| `TextShimmer` | — | The text. |

## Sound
- Keep every `data-slot` and `data-sound` attribute: the sound layer reads them.
- Installing this item adds no audio. Nothing plays until the app mounts `GlassSoundProvider` once (install: `npx shadcn@latest add https://beautiful-ui.dev/r/glass-sound.json`, import from `@/components/beautiful-ui/glass-sound`); `GlassSoundToggle` is its mute control. Without a provider the audio engine never loads.

## Match the original
- Read `components/ui/lumen/controls/text-shimmer.tsx` as the reference implementation before changing or recreating anything, and match it: sizes, colours per theme, motion timings, copy and behaviour.
- If you deviate (a prop you can't honour, a style you changed, a dependency you swapped), say so in your reply, part by part.
- Keep the accessibility contract, the keyboard map and the motion levels listed below.

## Use it when
- shimmer text, loading text, thinking, generating, working, AI status, pending label, skeleton text
- A step that's running: "Generating summary…", "Deploying to production", an assistant thinking
- Status lines in agent runs and long jobs, where a spinner would be too loud

### Not when
- Content that hasn't loaded: use Skeleton
- Anything that needs attention: a moving light reads as waiting, not as a warning

## Mistakes
- Don't shimmer more than one line at a time on a screen
- Set active={false} when work ends instead of unmounting: the words settle in place

## Usage

```tsx
"use client";

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

export function JobStatus({ running }: { running: boolean }) {
  return (
    <p role="status">
      <TextShimmer active={running}>{running ? "Summarising 24 support tickets…" : "Summary ready"}</TextShimmer>
    </p>
  );
}
```

## Props

| Prop | Type | Default | What it does |
|---|---|---|---|
| `active` | `boolean` | `true` | Sweeping while true; false settles the text to full ink. |
| `duration` | `number` | `2` | Seconds per sweep. |
| `as` | `"span" \| "p" \| "div"` | `"span"` | The element. |

Full docs: https://beautiful-ui.dev/components/lumen-text-shimmer

## Customising
- Colours: set the `--lumen-*` tokens on `:root`, or on a container with the `lumen-scope` class to retheme one area. Add the `lumen-inherit` class to follow your shadcn palette instead (`--chart-N`, `--destructive`).
- Dark mode follows the `.dark` class on an ancestor (the shadcn and next-themes convention).
- Update later by re-running the install with `--overwrite` (review the diff if you edited it). Changelog: https://beautiful-ui.dev/r/changelog.json

## Keyboard

| Keys | Action |
|---|---|
| Tab | Not focusable |

## Motion inventory

| Interaction | What moves |
|---|---|
| While active | A band of ink sweeps across the words every 2s; reduced motion holds it still |

## Accessibility contract (preserve when editing)
- The words are plain text: a screen reader reads them as they are
- Wrap changing status text in role=status so the change is announced
- Reduced motion stops the sweep and keeps the text muted

## Install

Base UI project (a base-* style in components.json):

```bash
npx shadcn@latest add https://beautiful-ui.dev/r/lumen-text-shimmer.json
```

Radix project (a radix-*, new-york or default style):

```bash
npx shadcn@latest add https://beautiful-ui.dev/r/radix-nova/lumen-text-shimmer.json
```

Or add the `@beautiful-ui` registry to components.json and run `npx shadcn@latest add @beautiful-ui/lumen-text-shimmer`: the CLI picks the build from your style.

## Credits
- Built on shadcn/ui (https://ui.shadcn.com)

## Source (Base UI build)

### components/ui/lumen/controls/text-shimmer.tsx

```tsx
"use client";
// Generated from src/registry/core/controls/text-shimmer.tsx by scripts/gen-systems.ts. Edit the core file, not this one.

import * as React from "react";
import { cn } from "@/lib/utils";

/*
 * Text Shimmer: work in progress, said in text. A narrow band of light passes across muted words
 * ("Generating summary…", "Deploying"), slowly enough to read as waiting rather than as a warning.
 * Turn it off (active={false}) when the work is done and the words settle to full ink. Under reduced
 * motion the band holds still and the text stays muted.
 *
 *   <TextShimmer>Searching 2,400 documents…</TextShimmer>
 */

type ShimmerTag = "span" | "p" | "div";

function TextShimmer({
  as: Tag = "span",
  active = true,
  duration = 2,
  className,
  style,
  children,
  ...props
}: React.ComponentProps<"span"> & {
  /** The element. Default span. */
  as?: ShimmerTag;
  /** Sweeping while true; false settles the text to full ink. */
  active?: boolean;
  /** Seconds per sweep. Default 2. */
  duration?: number;
}) {
  return (
    <Tag
      data-slot="text-shimmer"
      data-active={active || undefined}
      className={cn(`lumen-text-shimmer`, className)}
      style={{ "--shimmer-duration": `${duration}s`, ...style } as React.CSSProperties}
      {...(props as React.HTMLAttributes<HTMLElement>)}
    >
      {children}
    </Tag>
  );
}

export { TextShimmer };
```

### CSS (the registry `css` / `cssVars`, merged into the global stylesheet by the shadcn CLI)

```css
@layer components {
  .lumen-text-shimmer[data-active] {
    color: var(--gc-sec);
    -webkit-text-fill-color: transparent;
    background: linear-gradient(100deg,var(--gc-sec) 0%,var(--gc-sec) 42%,var(--gc-ink) 50%,var(--gc-sec) 58%,var(--gc-sec) 100%) 0 0/250% 100% no-repeat;
    -webkit-background-clip: text;
    background-clip: text;
    animation: lumen-shimmer var(--shimmer-duration,2s) linear infinite;
  }
  .lumen-text-shimmer {
    transition: color min(0.3s, var(--gcp-cm)) ease;
  }
  @keyframes lumen-shimmer {
    from {
      background-position: 100% 0;
    }
    to {
      background-position: 0 0;
    }
  }
  [dir="rtl"] .lumen-text-shimmer[data-active] {
    animation-direction: reverse;
  }
  @media (prefers-reduced-motion:reduce) {
    .lumen-text-shimmer[data-active] {
      animation: none;
      background: none;
      -webkit-text-fill-color: currentColor;
    }
  }
}
```

The lumen foundation (the tokens listed above, keyframes and motion levels) installs once with the first component; its CSS is public at https://beautiful-ui.dev/r/lumen-foundation.json.
