Blur Crossfade

Swaps content through a soft blur and eases the box to the new height.

Category
Creative
Access
Free with an account
Source
98 lines · one file
States
4 drawn
Added
21 Oct 2026

The decision inside it

You choose when it crosses

Only a new key starts the transition, so typing or live data inside never flickers.

When to use it

Use Blur Crossfade to swap one piece of content for another in the same place: monthly and yearly prices, the steps of a guide, a tab's body. Change contentKey to cross.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Liro's Blur Crossfade for this.
Install it: npx shadcn@latest add @liro/blur-crossfade
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/blur-crossfade.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Free components install through the @liro registry with your CLI token: see the Namespaced tab.

Usage

components/price-switch.tsx
import { BlurCrossfade } from "@/components/ui/blur-crossfade";

export function PriceSwitch({ yearly }: { yearly: boolean }) {
  return (
    <BlurCrossfade contentKey={yearly ? "yearly" : "monthly"} direction={yearly ? 1 : -1}>
      <p className="text-3xl font-semibold">{yearly ? "$120 / year" : "$12 / month"}</p>
    </BlurCrossfade>
  );
}

API reference

“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

TypeNotes
contentKeystring | number YesChange it to cross to the new children.
childrenReact.ReactNode Yes–
direction1 | -1 No1 for forward (the new content rises in), -1 for back. Default 1.
staggernumber NoSeconds between each direct child arriving; 0 moves them as one. Default 0.06.
durationnumber NoSeconds for the crossfade. Default 0.5.
blurnumber NoBlur at the start and end, in pixels. Default 10.
animateHeightboolean NoEase the box's height to fit the new content. Default true.

Dependencies

npm packages

clsxframer-motiontailwind-merge

Liro foundations, installed alongside it

liro-theme

States

All of them are drawn by the component. None is left for you to design.

  • Crossing
  • Height easing
  • Same key update
  • Reduced motion

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances