Fluid Cursor
A fullscreen GPU fluid simulation on near-black. Pointer movement injects velocity and spectral dye into a persistent velocity field with vorticity confinement and pressure solving, so colorful liquid keeps drifting, curling, and fading after the cursor leaves.
Installation#
pnpm dlx shadcn@latest add @davinciui/fluid-cursorUsage#
API Reference#
| Prop | Type | Default |
|---|---|---|
backgroundColorCanvas clear color. An explicit value always wins over the theme. | string | theme-aware (#000000 dark / #ffffff light) |
themeColor scheme. Auto follows the site theme live; the canvas background adapts without rebuilding the simulation. | "auto" | "light" | "dark" | "auto" |
intensityGlobal multiplier for splat force and dye amount. | number | 1 |
trailSizeSplat radius scale. 0.2–0.25 produces broad flowing masses. | number | 0.22 |
forceVelocity force injected per pointer travel. | number | 1 |
curlVorticity confinement strength. 20–35 gives visible curls and folds. | number | 28 |
velocityDissipationPer-frame velocity retention at 60fps. Higher = longer inertia. | number | 0.992 |
dyeDissipationPer-frame dye retention at 60fps. Higher = longer visible trails. | number | 0.975 |
densityDissipationAlias for dyeDissipation. | number | — |
colorSpeedInjected hue drift in spectrum cycles per second. | number | 0.12 |
brightnessOverall exposure multiplier. | number | 1 |
glowSubtle halo around dense fluid. 0 disables it. | number | 0.15 |
saturationColor saturation of the injected dye (0–1). | number | 0.85 |
colorModePalette behavior. Spectral matches the reference. | "spectral" | "ocean" | "sunset" | "mono" | "spectral" |
resolutionSimulation grid resolution. Dye uses a higher fixed grid. | number | 128 |
pressureIterationsPressure solver iterations (clamped 4–40). | number | 20 |
pointerSmoothingInjection-point easing (0–1). Lower = heavier smoothing. | number | 0.18 |
maxDprCap for devicePixelRatio. | number | 2 |
zIndexOverlay stacking order. | number | 10 |
disabledTurns the decorative overlay off without unmounting it. | boolean | false |
containerRefOptionally constrain pointer tracking and rendering to a positioned host. | RefObject<HTMLElement> | — |
classNameAdditional class name applied to the overlay wrapper. | string | — |
childrenContent layered above the effect. | ReactNode | — |
Accessibility#
The entire effect is decorative: the host and canvas are aria-hidden and pointer-events-none, so it adds nothing to the accessibility tree and never blocks interaction. There is no keyboard or focus behavior because it only responds to pointer movement.
Motion#
A WebGL fluid simulation injects velocity and dye along pointer movement, controlled by intensity, force, curl, velocityDissipation, dyeDissipation and pointerSmoothing. When prefers-reduced-motion matches at initialization, the loop renders one static frame and skips all simulation; changes to the preference are not observed live.
Known constraints#
- WebGL is required for the simulation; when the context is unavailable the effect cannot render.
- Coarse pointers and small viewports drop the simulation and dye resolution to keep the frame rate usable.
- The canvas is decorative, so pointer interactions must still work without it.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

