Skip to content
GitHub (opens in a new tab)

BlurCrossfade

A tiny wrapper that crossfades one child to the next when its key changes, for value and state swaps (a status chip going Running → Done, a thumbnail, a chart). A motion primitive, not a Card.

stableAtomcontracts/blurcrossfade.json

Preview

BlurCrossfade

A tiny wrapper that crossfades one child to the next when its key changes, for value and state swaps. A motion primitive, not a Card.

Master

It swaps Running ↔ Done on its own; pause it and swap by hand. The old value blurs out while the new one sharpens in over it.

Running

Usage

Wrap a small value and give it a contentKey; change the key to swap. fast is motion.duration200 (Paper's motion.fast), normal is motion.duration300. The outgoing value fades and blurs to 6px while the new one sharpens in; this blur is the kit's one approved exception to the transform/opacity rule. Under reduced motion there is no blur: the old value goes at once and the new one fades in over motion.duration100.

Do's

  • a status, value or thumbnail swaps in place and a hard cut would feel jumpy
  • announce the new value politely to screen readers while it swaps

Don'ts

  • a changing number — NumberTransition
  • text still being generated — ShimmerText
  • showing and hiding a panel — Collapsible or Accordion
  • page or route transitions
<BlurCrossfade contentKey={status} label={`Status: ${status}`}>
  <Tag dot={status === "done" ? "success" : "info"}>{label}</Tag>
</BlurCrossfade>

When to use

  • a status, value or thumbnail swaps in place and a hard cut would feel jumpy
  • announce the new value politely to screen readers while it swaps

When not to use

  • a changing number — NumberTransition
  • text still being generated — ShimmerText
  • showing and hiding a panel — Collapsible or Accordion
  • page or route transitions

What an agent reads

import { BlurCrossfade } from "agentic-ds-kit";
must
  • the outgoing layer is aria-hidden and inert
  • label, when set, is announced through aria-live=polite
  • honours prefers-reduced-motion
defaults
  • duration fast
stops if
  • Do not copy its blur into other components; the filter exception is for BlurCrossfade only
  • Do not wrap long or interactive regions; it is for small values
  • Do not pass raw ms; pick a duration token
  • Do not use raw hex

From contracts/blurcrossfade.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
childrennodeYes—The current value. Any child: Badge, image, chart.
contentKeystring|numberYes—Changing it triggers the swap. The outgoing layer shows the content as it was when that key arrived.
durationfast | normalNofastfast = motion.duration200 (Paper's motion.fast); normal = motion.duration300. No raw ms.
labelstringNo—Sent to an aria-live=polite region when the content swaps, e.g. "Status: Done".
  • Component
    →

    NumberTransition

    Rolling number treatment for live metrics and counters.

  • Component
    →

    ShimmerText

    Short live status copy (a running step, a loading line) with a highlight that sweeps over the text while the work runs.

  • Component
    →

    Collapsible

    Single show/hide panel.

  • Component
    →

    Accordion

    Disclosure list for short related sections: one open at a time, or several with type multiple.