07 · watch · loaders

Ripple grid Pro

A field of fine plus marks breathes outward from its centre while something loads; after dark its crest gives off a faint light.

Install

bash
npx shadcn@latest add @mu-pro/ripple-grid

Pro. Installs with a licence key through the @mu-pro registry. Checkout opens soon: until then Pro installs are closed, and nothing can be bought on this site.

Usage

tsx
import { RippleGrid } from "@/components/mu/ripple-grid/RippleGrid";

<RippleGrid />

How it works

Input and reduced motion

  • Pointer / touch: none; it is a status, not a control.
  • Keyboard: not focusable. Screen readers hear the caption (or label), then doneLabel.
  • Off-screen: the loop (and the crest's light) pauses and keeps its phase.
  • Arrive and leave: from a 4px blur over 200ms, no travel; on done it fades as the wave runs on.
  • Reduced motion: no travel and no swell; the whole field breathes its opacity together, slowly; no crest, so no tint and no light; it arrives without the blur, and on done it goes at once.
  • Sound: none. A loader plays for the whole wait, so it stays silent.

Place it

One scale for every loader (FOUNDATION, ### loaders). The box is exactly size and never shifts the layout.

// inline, in a sentence (xs: 1em of the text, 16px in body text). The root is a
// <span> and every part is phrasing content, so it is valid inside a <p>, a <label>
// or a <button>; at body leading (text-sm, text-base) the line keeps its height
<p className="text-sm">
  Syncing your library <RippleGrid size="xs" label="Syncing" done={!loading} />
</p>

// or as a status line of its own: the caption is the line's text and carries its baseline
<p className="text-sm text-muted-foreground">
  <RippleGrid size="xs" caption="Loading your set…" done={!loading} />
</p>

// in a button: the loader takes the icon's slot, so the button keeps its width;
// aria-disabled (not disabled) keeps a keyboard user's focus while it saves
<Button aria-disabled={saving} aria-busy={saving} onClick={() => !saving && save()}>
  {saving ? <RippleGrid size="sm" data-icon="inline-start" /> : <Save data-icon="inline-start" />}
  Save
</Button>

// centred in a card or empty state, with a caption (reserve the box: 104px with p-6;
// a 1px border adds 2px, so min-h-[106px] with one)
<div className="grid min-h-[104px] place-items-center p-6">
  <RippleGrid size="md" caption="Fetching 24 tracks" done={!loading} onExited={() => setShown(false)} />
</div>

// over a section: the content stays laid out underneath
<section className="relative" aria-busy={busy}>
  <div inert={busy}>{children}</div>
  {shown && (
    <div className="absolute inset-0 grid place-items-center bg-background/80">
      <RippleGrid size="lg" caption="Rendering" done={!busy} onExited={() => setShown(false)} />
    </div>
  )}
</section>

Props

PropDefaultWhat it does
size"md"xs · sm · md · lg · xl | the loader scale: 1em of the text, snapped to 4px (16 in body text) · 16 · 32 · 64 · 160px. 3×3 marks at xs/sm, 4×4 at md, 6×6 at lg/xl
donefalse— | true fades the field while its wave travels on (300ms), then stops the loop and calls onExited
accentfalse— | tints the crest with --mu-signal by opacity, not a colour loop: its ink by day, its light after dark (the crest keeps the ink, its halo takes the colour). The resting marks stay in the text colour; at xs and sm after dark the marks have no light, so it has no effect there
caption—text | visible: beside the marks at xs/sm (the line's own text), below them at md and up (muted). Screen readers hear it
label"Loading"— | what a screen reader hears when there is no caption (role="status", polite)
doneLabel"Loaded"— | what it hears once done
onExited—— | called when the exit has finished, so you can remove it
className—— | added to the root

Licence

Included with Pro: use it in unlimited end products for you and your clients; no reselling as a kit. See the licence.