Proximity Blur Text
Words near the pointer stay sharp while surrounding words smoothly blur and dim using cached word centers.
Move pointer across the words to focus (disabled on coarse pointers).
Customize
Installation
npx shadcn@latest add @kinetic/proximity-blur-textUsage
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.
| Prop | Type | Default | Description |
|---|---|---|---|
text | string | - | Paragraph or sentence text. |
radiusPx | number | 160 | Outer blur falloff radius in pixels. |
maxBlurPx | number | 5 | Maximum blur applied to distant words. |
minOpacity | number | 0.35 | Minimum opacity for distant words. |