Shimmering Text
Text with a bright highlight that sweeps across it on a loop, built from semantic tokens via bg-clip-text. Pure CSS, motion-safe (reduced motion shows static muted text).
Preview
<div class="space-y-6">
<x-ui.shimmering-text as="span" class="text-3xl font-semibold">
{{ __('Generating response…') }}
</x-ui.shimmering-text>
<x-ui.shimmering-text as="span" :duration="3" :spread="3" class="text-base">
{{ __('Thinking through the best answer for you') }}
</x-ui.shimmering-text>
</div>
Installation
php artisan ui:add shimmering-text
Registry contract
php artisan ui:add shimmering-text
writes only the files below. The CLI validates each file hash before writing and asks before it replaces a local change, unless you pass --force.
-
resources/views/components/ui/shimmering-text.blade.php
- Registry dependencies
- None — installs on its own.
- Packages
-
composer: jml/brok:^0.2
Use with AI
A brief for your coding agent: install command, usage, props, guidance and the rules. Copy it, or open a prompt about this component in an assistant.
# Brok UI: Shimmering Text (`shimmering-text`)
Text with a bright highlight that sweeps across it on a loop, built from semantic tokens via bg-clip-text. Pure CSS, motion-safe (reduced motion shows static muted text).
Brok UI is a Laravel Blade component registry. Installed components are plain Blade files the app owns.
## Install
```bash
php artisan ui:add shimmering-text
```
## Usage
```blade
<div class="space-y-6">
<x-ui.shimmering-text as="span" class="text-3xl font-semibold">
{{ __('Generating response…') }}
</x-ui.shimmering-text>
<x-ui.shimmering-text as="span" :duration="3" :spread="3" class="text-base">
{{ __('Thinking through the best answer for you') }}
</x-ui.shimmering-text>
</div>
```
## Props
- `as` (string, default `span`) — Root tag: span, p, or h1 through h6.
- `duration` (int, default `2`) — Seconds for one sweep of the highlight, clamped to a minimum of 0.1.
- `spread` (int, default `2`) — Width of the bright band, in rem, clamped to a minimum of 0.
## Use when
- Use only when visual expression supports storytelling, brand differentiation, or a clear showcase moment.
- Adding a subtle, looping bright-highlight sweep across a heading or label to suggest premium or loading emphasis.
- Wanting a pure-CSS text effect built entirely from semantic tokens, with tunable sweep duration and band width.
## Avoid when
- Do not place heavy effects in task-dense workflows where clarity, speed, and readability matter more.
- Needing a loading indicator with a status role; use text-loader instead, since this component carries no ARIA status semantics.
- Applying the effect to long paragraphs; a continuously sweeping highlight is best for short headlines or labels.
## Anti-patterns
- Heavy effects in forms or task-dense workflows
- Motion that interferes with reading or focus
## Rules
- Use the `<brok:shimmering-text>` tag (or `<x-ui.shimmering-text>`) in Blade; do not rewrite the component.
- Prefer the documented props and variants over utility-class overrides; when a utility must win, use the `!` important modifier.
- Use semantic design tokens (`bg-primary`, `text-muted-foreground`), never raw colour utilities.
- Keep the `data-slot` attributes; they are the styling and test hooks.
## Links
- Docs: https://brokui.dev/docs/components/shimmering-text
- Registry JSON (files, props, contract): https://brokui.dev/r/open/shimmering-text.json
Working in Claude Code, Cursor or Codex? Give the agent the whole registry through the MCP server or the Brok UI skill.
API
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| as | string | span | Root tag: span, p, or h1 through h6. |
| duration | int | 2 | Seconds for one sweep of the highlight, clamped to a minimum of 0.1. |
| spread | int | 2 | Width of the bright band, in rem, clamped to a minimum of 0. |
Slots
default— The text the shimmer sweeps across.
Renders as span, p, h1, h2, h3, h4, h5, h6.
Data slots
Stable hooks for CSS overrides and browser tests.
Behavior
- The resting glyph colour is muted-foreground and the moving highlight band is foreground, both wired through bg-clip-text so only the text itself shows colour.
- The effect is motion-safe only; reduced-motion users see calm, static muted text instead of the sweeping highlight.
- Declares registry capability flags: a11y, responsive, rtl, darkMode, localized, reducedMotion.
Guidance
Support brand expression or a showcase moment.
Use when
- Use only when visual expression supports storytelling, brand differentiation, or a clear showcase moment.
- Adding a subtle, looping bright-highlight sweep across a heading or label to suggest premium or loading emphasis.
- Wanting a pure-CSS text effect built entirely from semantic tokens, with tunable sweep duration and band width.
Avoid when
- Do not place heavy effects in task-dense workflows where clarity, speed, and readability matter more.
- Needing a loading indicator with a status role; use text-loader instead, since this component carries no ARIA status semantics.
- Applying the effect to long paragraphs; a continuously sweeping highlight is best for short headlines or labels.
Use instead
- Static content-first presentation
Anti-patterns
- Heavy effects in forms or task-dense workflows
- Motion that interferes with reading or focus
- Anatomy
- Theming hooks
Accessibility
- Keyboard
- No component-owned keyboard interaction; native element behavior applies.
- Focus
none
- The text content itself is real, selectable text rather than an image or canvas, so it stays fully accessible without extra labelling.
- Colour comes entirely from semantic tokens, so contrast and theming stay correct in dark mode.
- Semantic HTML and a stable
data-slotattribute for styling and scripting hooks. - Focus-visible rings use the
ringtoken, so keyboard focus is always visible. - Disabled and invalid states are conveyed to assistive tech, not by color alone.
- Targets WCAG 2.2 AA; verify contrast in light, dark, admin and customer surfaces in the preview.
- Labels go through
__()and layout uses logical properties (ms-*,text-start), so it mirrors underdir="rtl"— flip the preview to RTL to confirm. - Dark mode uses the same semantic tokens under the
darkclass; high contrast follows forced-color system tokens.
Livewire
Livewire can update this component through forwarded wire:* attributes.
Source
The exact, editable file ui:add writes
into your app. Previews render this same code; there are no preview-only components.
@props([
'as' => 'span',
'duration' => 2,
'spread' => 2,
])
@php
// A bright highlight sweeps across muted text, looping. The effect is built
// entirely from semantic tokens: the resting glyph colour is `--muted-foreground`
// and the moving band is `--foreground`, both wired up in ui.css keyed off
// `data-slot` (so nothing raw-coloured lives in this markup). Only the two
// numeric tuning knobs travel inline as CSS custom properties:
// --shimmer-duration : seconds for one sweep
// --shimmer-spread : width of the bright band (rem)
// Motion-safe only — reduced-motion users see calm, static muted text.
$dur = is_numeric($duration) ? max(0.1, (float) $duration) : 2;
$spread = is_numeric($spread) ? max(0, (float) $spread) : 2;
$allowedTags = ['span', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
$tag = in_array($as, $allowedTags, true) ? $as : 'span';
@endphp
<{{ $tag }}
data-slot="shimmering-text"
data-animate="true"
style="--shimmer-duration: {{ $dur }}s; --shimmer-spread: {{ $spread }}rem;"
{{ $attributes->merge(['class' => 'relative inline-block bg-clip-text text-transparent']) }}
>{{ $slot }}</{{ $tag }}>
Ownership & lifecycle
Owner, release state, review evidence and adoption for this item.
- Owner
- Platform UI (@JoshJML)
- Current version
-
1.1.4 - Status
- Stable
- License
-
open - Accessibility reviewed
- No review date recorded
- Last breaking change
- No date recorded
- Deprecation
- Not deprecated
- Contract
-
v6 - Foundation
-
≥ 1.0.0