Chroma Blur Transition

A client-side wrapper that swaps its children when transitionKey changes, covering the swap with a WebGL shader sweep of soft chromatic blur. It falls back to an instant swap when reduced motion is requested or WebGL is unavailable.

Chroma Blur Transition
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add @smoothui/chroma-blur-transition

Requires @smoothui in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import ChromaBlurTransition from '@/components/smoothui/chroma-blur-transition';<ChromaBlurTransition transitionKey={activeKey} className='h-64'>  {content}</ChromaBlurTransition>
  • Switching between tabs, panels or views where the content should change with a glowing, premium-feeling wash instead of a hard cut.
  • Showing a new page, slide or step inside a fixed card or hero area while keeping the surrounding layout stable.
  • Highlighting a content change in a marketing or product surface where a decorative shader transition fits the brand.
  • Avoid it for dense data tables or form flows where users need an immediate, unobstructed content change.

Examples

Tab content switch

Changing the selected tab updates transitionKey, which plays the sweep and swaps the rendered panel at the midpoint.

tab-content-switch.tsx
import ChromaBlurTransition from '@/components/smoothui/chroma-blur-transition';import { useState } from 'react';export default function PricingTabs() {  const [tab, setTab] = useState<'overview' | 'pricing'>('overview');  return (    <div>      <button type='button' onClick={() => setTab('overview')}>Overview</button>      <button type='button' onClick={() => setTab('pricing')}>Pricing</button>      <ChromaBlurTransition transitionKey={tab} className='h-64 p-6'>        {tab === 'overview' ? <p>Overview content</p> : <p>Pricing content</p>}      </ChromaBlurTransition>    </div>  );}

Step wizard with onRest

Uses the numeric step as transitionKey and runs onRest after the transition has fully finished, for example to move focus to the new heading.

step-wizard-with-onrest.tsx
import ChromaBlurTransition from '@/components/smoothui/chroma-blur-transition';import { useRef, useState } from 'react';const steps = ['Account', 'Profile', 'Done'];export default function Wizard() {  const [step, setStep] = useState(0);  const headingRef = useRef<HTMLHeadingElement>(null);  return (    <section>      <ChromaBlurTransition        transitionKey={step}        duration={800}        onRest={() => headingRef.current?.focus()}      >        <h2 ref={headingRef} tabIndex={-1}>{steps[step]}</h2>      </ChromaBlurTransition>      <button type='button' onClick={() => setStep((s) => Math.min(s + 1, steps.length - 1))}>Next</button>    </section>  );}

Custom duration and sizing

Shortens the sweep with duration and sets the wrapper size through className, which is merged into the root element.

custom-duration-and-sizing.tsx
import ChromaBlurTransition from '@/components/smoothui/chroma-blur-transition';export default function Gallery({ index, src }: { index: number; src: string }) {  return (    <ChromaBlurTransition transitionKey={index} duration={700} className='aspect-video w-full max-w-xl'>      <img src={src} alt='Gallery item' className='h-full w-full object-cover' />    </ChromaBlurTransition>  );}

API reference

PropTypeDefaultDescription
childrenReactNode—Content rendered in the wrapper. The rendered content is replaced at the transition midpoint when transitionKey changes.
classNamestring—Additional classes merged into the root container with cn(). The base classes set relative, isolate, overflow-hidden, rounded-2xl, bg-background and text-foreground.
durationnumber1040Length of the sweep in milliseconds before the fade-out. The default is 1040. A short fade of about 90ms follows the sweep.
onRest() => void—Called once the transition has finished and the overlay has faded out. Also called immediately when reduced motion is on, when WebGL is unavailable, or when the key does not change in a way that starts a playback.
transitionKeystring | number—Identifier for the current content. A change to this value starts a transition. Changes that happen during a running transition cancel it and start a new one.

Accessibility

  • With prefers-reduced-motion set, useReducedMotion makes the component swap children immediately, skip the shader, and keep the canvas at opacity-0.
  • The canvas is decorative and has pointer-events-none, so it does not block clicks or text selection. The source sets no ARIA attributes on it, so add aria-hidden='true' in your own wrapper if your audit requires it.
  • Content is swapped in the DOM at the midpoint, so focus on an element that gets replaced is lost. Move focus to the new content (for example from onRest) when the change is user-initiated.
  • data-transitioning='true' is set on the root while the sweep runs. Use it for styling or tests, not as a substitute for announcing content changes; use an aria-live region when the new content needs to be announced.
  • If WebGL is unavailable, the component renders the content with no overlay and calls onRest, so the content stays usable without the effect.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Chroma Blur Transition" component (smoothui/chroma-blur-transition) from its shadcn registry.1. Install it with: npx shadcn@latest add @smoothui/chroma-blur-transition2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: children, className, duration, onRest, transitionKey.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport ChromaBlurTransition from '@/components/smoothui/chroma-blur-transition';<ChromaBlurTransition transitionKey={activeKey} className='h-64'>  {content}</ChromaBlurTransition>```

Files & dependencies

  • index.tsx→ components/smoothui/chroma-blur-transition/index.tsx
dependenciesmotion

Looks similar, elsewhere