Shader Lens Blur

ShaderLensBlur is a client-side WebGL (Three.js) hero or background component that renders an animated pastel gradient inside a geometric shape, with a lens-style color inversion that follows the pointer or touch. Its configuration is shared through the exported jotai atom configAtom, and the component itself takes no props.

Shader Lens Blur
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 @cult-ui/shader-lens-blur

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

Usage

usage.tsx
import { ShaderLensBlur } from "@/components/ui/shader-lens-blur"<ShaderLensBlur />
  • Use as an interactive hero or feature background where a mesmerizing, glass-like WebGL effect should respond to the cursor or touch.
  • Use when you want a lightweight, self-contained shader visual without writing GLSL, and you can configure colors and shape through a single jotai atom.
  • Avoid on pages that must stay static or must run cheaply on low-end devices, because it runs a continuous requestAnimationFrame render loop with WebGL.

Examples

Default hero background

Renders the shader with the default configuration inside a full-width section. The container's width and height come from the atom defaults (100% by 400px), so wrap it in a sized parent if you need a different size.

default-hero-background.tsx
import { ShaderLensBlur } from "@/components/ui/shader-lens-blur"export default function HeroSection() {  return (    <section className="mx-auto max-w-5xl p-6">      <h1 className="mb-4 text-3xl font-bold">Interactive Lens</h1>      <ShaderLensBlur />    </section>  )}

Customizing colors and shape via configAtom

Updates the shared configAtom to switch to the filled circle variation with custom colors and a taller canvas. The shader component reads this atom and re-applies the uniforms when it changes.

customizing-colors-and-shape-via-configatom.tsx
import { useSetAtom } from "jotai"import { ShaderLensBlur, configAtom } from "@/components/ui/shader-lens-blur"export function ShaderPresetButton() {  const setConfig = useSetAtom(configAtom)  return (    <div className="space-y-4">      <button        type="button"        onClick={() =>          setConfig((prev) => ({            ...prev,            variation: 1,            color1: "#FF6B6B",            color2: "#FFD93D",            color3: "#6BCB77",            color4: "#4D96FF",            height: "520px",          }))        }      >        Switch preset      </button>      <ShaderLensBlur />    </div>  )}

Static hover-off variant with normal mouse mode

Disables the hover-driven highlight and uses normal (non-inverted) mouse mode. The lens effect then only responds while the pointer is pressed or touching, because enableHover is false.

static-hover-off-variant-with-normal-mouse-mode.tsx
import { useSetAtom } from "jotai"import { ShaderLensBlur, configAtom } from "@/components/ui/shader-lens-blur"export function PressToReveal() {  const setConfig = useSetAtom(configAtom)  setConfig((prev) => ({    ...prev,    enableHover: false,    invertMouse: false,    variation: 2,  }))  return <ShaderLensBlur />}

API reference

PropTypeDefaultDescription
ShaderLensBlur() => JSX.Element—The exported component takes no props. All configuration is read from configAtom.
configAtom.variationnumber3Shape variant used by the shader: 0 rounded-rectangle outline, 1 filled circle, 2 ring, 3 soft triangle. Other values render no shape.
configAtom.color1string"#D5F981"First gradient color (hex string), applied as a THREE.Color uniform.
configAtom.color2string"#A1BBE7"Second gradient color (hex string).
configAtom.color3string"#F2BAE2"Third gradient color (hex string).
configAtom.color4string"#68E8FA"Fourth gradient color (hex string).
configAtom.enableHoverbooleantrueWhen true, the lens effect is active on pointer movement without pressing. When false, it only responds while pointer or touch is down.
configAtom.invertMousebooleantrueWhen true, the lens region inverts the area outside the pointer circle (inverted mouse mode). When false, the pointer circle itself is inverted.
configAtom.widthstring"100%"CSS width applied to the container element.
configAtom.heightstring"400px"CSS height applied to the container element.

Accessibility

  • The canvas has no role, label, or alternative text, so screen readers will treat the visual as unlabeled content. If the effect is purely decorative, wrap the component in an element with aria-hidden="true".
  • The caption text ('Inverted mouse interaction' or 'Interact with the animation using mouse or touch') is real DOM text and remains available to assistive technology.
  • The component offers no keyboard interaction. It responds only to pointer and touch events, so keyboard-only users cannot trigger the lens effect.
  • The animation runs continuously through requestAnimationFrame and does not check prefers-reduced-motion. Consider disabling it or using a static variant for users who request reduced motion.
  • The caption color changes between neutral-300 and neutral-200 depending on theme and is drawn over the canvas. Verify contrast against the rendered gradient colors if you change the palette.
  • The component reads the theme through next-themes. Wrap your app in a ThemeProvider so the dark and light styling works as intended.

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 "Shader Lens Blur" component (cult-ui/shader-lens-blur) from its shadcn registry.1. Install it with: npx shadcn@latest add @cult-ui/shader-lens-blur2. 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: ShaderLensBlur, configAtom.variation, configAtom.color1, configAtom.color2, configAtom.color3, configAtom.color4, configAtom.enableHover, configAtom.invertMouse, configAtom.width, configAtom.height.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { ShaderLensBlur } from "@/components/ui/shader-lens-blur"<ShaderLensBlur />```

Files & dependencies

  • registry/default/ui/shader-lens-blur.tsx
dependenciesmotionthreejotainext-themes

Looks similar, elsewhere