Skip to main content

Proximity Blur Text

Words near the pointer stay sharp while surrounding words smoothly blur and dim using cached word centers.

Good design guides the eye to what matters most. Everything else recedes softly like depth of field in a photograph.

Move pointer across the words to focus (disabled on coarse pointers).

Customize

Radius (px)160
Max blur (px)5
Min opacity0.35

Installation

npx shadcn@latest add @kinetic/proximity-blur-text

Usage

Pass a sentence to ProximityBlurText. Words inside innerRadiusPx stay crisp while words farther out soften toward maxBlurPx and minOpacity.

import { ProximityBlurText } from "@/components/kinetic/ui/proximity-blur-text";

interface HeroSentenceProps {
  readonly headline: string;
}

export function HeroSentence({ headline }: HeroSentenceProps) {
  return (
    <ProximityBlurText
      text={headline}
      radiusPx={180}
      innerRadiusPx={44}
      maxBlurPx={5}
      minOpacity={0.35}
      className="text-2xl font-medium tracking-tight"
    />
  );
}

Focus radius and falloff

innerRadiusPx sets the sharp focus zone around the pointer and radiusPx sets where blur and dimming reach their maximum. maxBlurPx is clamped to 8 pixels to keep filter compositing fast.

<ProximityBlurText
  text="Move across the line to pull individual words into focus."
  innerRadiusPx={32}
  radiusPx={140}
  maxBlurPx={6}
  minOpacity={0.3}
/>

Imperative control

Attach a ref typed as ProximityBlurTextHandle to trigger a focus sweep with play() or clear all inline blur and opacity styles with reverse().

import { useRef } from "react";
import {
  ProximityBlurText,
  type ProximityBlurTextHandle,
} from "@/components/kinetic/ui/proximity-blur-text";

export function ControlledProximity() {
  const ref = useRef<ProximityBlurTextHandle>(null);

  return (
    <div>
      <ProximityBlurText
        ref={ref}
        text="Sweep focus across the headline on demand."
        trigger="manual"
      />
      <button type="button" onClick={() => ref.current?.play()}>
        Play sweep
      </button>
      <button type="button" onClick={() => ref.current?.reverse()}>
        Clear
      </button>
    </div>
  );
}

Motion preferences

Proximity tracking is disabled on coarse pointer devices (pointer: coarse) and whenever reduced motion is active, rendering crisp text immediately and calling onComplete. Global tempo and speed scale the sweep duration.

API Reference

ProximityBlurText

Pointer-reactive word blur with one-shot geometry caching and coarse-pointer opt-out.

PropTypeDefaultDescription
textstring-Paragraph or sentence text.
radiusPxnumber160Outer blur falloff radius in pixels.
maxBlurPxnumber5Maximum blur applied to distant words.
minOpacitynumber0.35Minimum opacity for distant words.