Loaders
A loading-ui.com-inspired family of animated loaders — spinners, dots, orbital, bars, square grids, shapes, text and a few playful ones — all token-themed and reduced-motion safe.
Preview
<div class="flex flex-col items-start gap-6">
<div class="flex flex-col items-start gap-1">
<x-ui.text-loader variant="shimmer" text="Loading" />
<span class="text-xs text-muted-foreground">shimmer</span>
</div>
<div class="flex flex-col items-start gap-1">
<x-ui.text-loader variant="blink" text="Loading" />
<span class="text-xs text-muted-foreground">blink</span>
</div>
<div class="flex flex-col items-start gap-1">
<x-ui.text-loader variant="dots" text="Loading" />
<span class="text-xs text-muted-foreground">dots</span>
</div>
<div class="flex flex-col items-start gap-1">
<x-ui.text-loader variant="wave" text="Loading" />
<span class="text-xs text-muted-foreground">wave</span>
</div>
</div>
Installation
php artisan ui:add text-loader
Registry contract
php artisan ui:add text-loader
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/text-loader.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: Text Loader (`text-loader`)
Text-based loading indicator in four variants — shimmer sweep, blink fade, trailing dots and a per-letter wave.
Brok UI is a Laravel Blade component registry. Installed components are plain Blade files the app owns.
## Install
```bash
php artisan ui:add text-loader
```
## Usage
```blade
<div class="flex flex-col items-start gap-6">
<div class="flex flex-col items-start gap-1">
<x-ui.text-loader variant="shimmer" text="Loading" />
<span class="text-xs text-muted-foreground">shimmer</span>
</div>
<div class="flex flex-col items-start gap-1">
<x-ui.text-loader variant="blink" text="Loading" />
<span class="text-xs text-muted-foreground">blink</span>
</div>
<div class="flex flex-col items-start gap-1">
<x-ui.text-loader variant="dots" text="Loading" />
<span class="text-xs text-muted-foreground">dots</span>
</div>
<div class="flex flex-col items-start gap-1">
<x-ui.text-loader variant="wave" text="Loading" />
<span class="text-xs text-muted-foreground">wave</span>
</div>
</div>
```
## Props
- `variant` (shimmer|blink|dots|wave, default `shimmer`) — Motion pattern: shimmer, blink, dots, or wave.
- `text` (string, default `Loading`) — The loading message, both displayed and used as the accessible label.
- `size` (md|sm|lg, default `md`) — Text size: sm, md, or lg.
## Use when
- Use while content or system work is in progress so users understand the interface is responding.
- Indicating an in-progress action with the loading text itself as the animated element, instead of a separate icon.
- Wanting a choice of four text motions (shimmer, blink, dots, wave) to match a loading-ui.com aesthetic.
## Avoid when
- Do not use indefinite loading indicators when you can show structure, progress, or a next step instead.
- Needing an icon-only, compact loading indicator; use spinner or one of the shape loaders instead.
- Showing a determinate progress value; use progress instead.
## Anti-patterns
- Indefinite loading with no progress or recovery
## Rules
- Use the `<brok:text-loader>` tag (or `<x-ui.text-loader>`) 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/text-loader
- Registry JSON (files, props, contract): https://brokui.dev/r/open/text-loader.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 |
|---|---|---|---|
| variant | shimmer | blink | dots | wave | shimmer | Motion pattern: shimmer, blink, dots, or wave. |
| text | string | Loading | The loading message, both displayed and used as the accessible label. |
| size | md | sm | lg | md | Text size: sm, md, or lg. |
Slots
default— Unused; the component has no visible default slot content.
Data slots
Stable hooks for CSS overrides and browser tests.
Behavior
- shimmer sweeps a bright band across the text via bg-clip-text; blink fades the whole text's opacity; dots appends trailing dots one-by-one; wave bobs each letter in a travelling wave.
- Motion is disabled under prefers-reduced-motion; the accessible label is always present in the markup regardless of variant.
- Declares registry capability flags: a11y, responsive, rtl, darkMode, localized, reducedMotion.
Guidance
Show that content or system work is in progress.
Use when
- Use while content or system work is in progress so users understand the interface is responding.
- Indicating an in-progress action with the loading text itself as the animated element, instead of a separate icon.
- Wanting a choice of four text motions (shimmer, blink, dots, wave) to match a loading-ui.com aesthetic.
Avoid when
- Do not use indefinite loading indicators when you can show structure, progress, or a next step instead.
- Needing an icon-only, compact loading indicator; use spinner or one of the shape loaders instead.
- Showing a determinate progress value; use progress instead.
Use instead
- Skeleton for known layout
- Determinate progress for measurable work
Anti-patterns
- Indefinite loading with no progress or recovery
- Anatomy
- Theming hooks
Accessibility
- Keyboard
- No component-owned keyboard interaction; native element behavior applies.
- Focus
none
- The root carries role="status" and an aria-label built from the text prop, independent of how the variant renders the text visually.
- The dots and wave variants render their extra decorative spans as aria-hidden so the label is announced once, not per letter.
- 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([
'variant' => 'shimmer',
'text' => 'Loading',
'size' => 'md',
])
@php
$styles = require base_path(config('ui.component_path', 'resources/views/components/ui').'/_styles.php');
$variant = $styles['normalizeVariant']($variant);
// Text-based loaders faithful to loading-ui.com. Four visually distinct
// variants — `shimmer` (a bright foreground band sweeps across muted text via
// bg-clip-text), `blink` (whole text fades opacity), `dots` (trailing dots
// appear one-by-one) and `wave` (each letter bobs in a travelling wave). All
// motion lives in ui.css keyed on [data-slot="text-loader"][data-variant="…"]
// and is gated for reduced-motion; all colour comes from semantic tokens so it
// themes for free. The only inline styles are non-colour timing knobs
// (animation-delay), and the accessible name is always present in the markup.
$allowed = ['shimmer', 'blink', 'dots', 'wave'];
$variant = in_array($variant, $allowed, true) ? $variant : 'shimmer';
$sizes = [
'sm' => 'text-sm',
'md' => 'text-base',
'lg' => 'text-lg',
];
$size = array_key_exists($size, $sizes) ? $size : 'md';
$sizeClass = $sizes[$size];
$label = __($text);
@endphp
<div
data-slot="text-loader"
data-variant="{{ $variant }}"
data-size="{{ $size }}"
role="status"
aria-label="{{ $label }}"
{{ $attributes->merge(['class' => 'inline-flex items-center font-medium text-muted-foreground '.$sizeClass]) }}
>
@if ($variant === 'shimmer')
<span class="text-loader-shimmer relative inline-block bg-clip-text text-transparent">{{ $label }}</span>
@elseif ($variant === 'blink')
<span class="text-loader-blink inline-block">{{ $label }}</span>
@elseif ($variant === 'dots')
<span>{{ $label }}</span><span class="inline-flex" aria-hidden="true"><span class="text-loader-dot" style="animation-delay:0ms">.</span><span class="text-loader-dot" style="animation-delay:200ms">.</span><span class="text-loader-dot" style="animation-delay:400ms">.</span></span>
@elseif ($variant === 'wave')
@php
$chars = preg_split('//u', $label, -1, PREG_SPLIT_NO_EMPTY) ?: [];
@endphp
<span aria-hidden="true">@foreach ($chars as $i => $char)<span class="text-loader-wave-letter inline-block" style="animation-delay:{{ $i * 80 }}ms">@if ($char === ' '){!! ' ' !!}@else{{ $char }}@endif</span>@endforeach</span>
@endif
</div>
Ownership & lifecycle
Owner, release state, review evidence and adoption for this item.
- Owner
- Platform UI (@JoshJML)
- Current version
-
1.1.2 - 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