Dispersed Text

v1.1.0
FreeWebGLTextBackgroundInteractiveReduced Motion

An advanced interactive typography component where text morphs liquidly on content change and disperses into custom particle fields (flow, explode, attract, wind, gravity, vortex) on interaction. Supports solid or gradient colors, speed-based color mapping, neon glow, custom shapes, and manual animation triggers.

Dispersed Text

Installation

npx vectorvesper add dispersed-text

Run npx vectorvesper init once first to set up your project.

Dependencies

npm install framer-motion
  • framer-motion

Usage

Import

import { DispersedText } from "@/components/vv/dispersed-text";

Usage

<DispersedText />

Client-only component — disable SSR

This component requires browser APIs and must be rendered client-side only.

import dynamic from "next/dynamic";

const DispersedText = dynamic(
  () => import("@/components/vv/dispersed-text").then((m) => m.DispersedText),
  { ssr: false }
);
This component respects prefers-reduced-motion and provides a graceful fallback.

Props

An advanced interactive typography component where text morphs liquidly on content change and disperses into custom particle fields (flow, explode, attract, wind, gravity, vortex) on interaction. Supports solid or gradient colors, speed-based color mapping, neon glow, custom shapes, and manual animation triggers.

<DispersedText />

A transparent <canvas> that fills its parent — give the parent a size (e.g. a full-height hero or `absolute inset-0`) and set `color` to contrast with whatever is behind it. Renders the word accessibly via role="img" + aria-label.

PropTypeDefaultDescription
text*stringThe word, phrase, or short sentence to form. Particles morph dynamically to new target coordinates when the text changes.
fontSizenumberExplicit font size in pixels. If provided, disables dynamic fitWidth width-fitting logic to enforce a constant font height.
colorstring"#7EACB5"Particle color (any CSS color string). Used as the base color for solid and speed modes.
gapnumber6Pixel sampling step. Smaller = denser text and more particles (heavier performance).
fontWeightnumber | string700Weight used when sampling the text layout.
fontFamilystringsystem sans stackFont stack used when sampling. Web fonts are awaited before sampling to ensure correctness.
fitWidthnumber0.82Fraction of the canvas width the text block spans (0–1).
lineHeightnumber1.15Line-height multiplier when text wraps onto multiple lines.
springnumber0.08Home-pull spring strength — how fast particles assemble and reform.
meltSpeednumber0.06Easing speed of the dispersion/gather transition (per frame, 0–1).
swirlnumber1.2Vortex force strength applied on cursor interaction.
swirlRadiusnumber160Influence radius in px around the cursor vortex.
streaknumber5Comet tail length while moving. Set to `0` for round dots.
dotSizenumber1.7Base dot size or streak thickness in px.
turbulencenumber1Turbulence noise speed — higher values create busier currents.
maxDprnumber2Caps the device pixel ratio for mobile performance optimization.
debugbooleanfalsePaints a live fps + particle-count readout onto the canvas.
classNamestring""Extra classes applied to the canvas element.
styleReact.CSSPropertiesInline style overrides for the canvas element.
aria-labelstring= textAccessible image description for screen readers.
interactionMode"flow" | "explode" | "attract" | "vortex" | "wind" | "gravity""flow"The physics model applied when particles disperse.
colorMode"solid" | "gradient" | "speed""solid"Method of coloring particles (solid color, linear gradient, or speed-velocity heatmap).
gradientColorsstring[]["#7EACB5", "#E07B9B"]List of gradient colors stops (used when colorMode is 'gradient').
gradientDirection"horizontal" | "vertical" | "diagonal""horizontal"Direction of the linear color gradient.
speedColorstring"#FF007A"Highlight color that particles morph into at peak velocity (used in speed mode).
shape"circle" | "square" | "triangle" | "star""circle"Geometric particle shape style.
glowbooleanfalseEnables hardware-accelerated neon drop-shadow glow.
glowColorstring= colorColor of the neon drop-shadow glow.
glowBlurnumber8Neon glow blur radius in pixels.
trigger"hover" | "click" | "manual""hover"Interaction trigger that initiates dispersion.
isDispersedbooleanfalseForce dispersion in manual trigger mode.
progressnumber0Continuous manual control progress (0 to 1) in manual trigger mode.
windAnglenumber0Angle of wind in radians (0 is right, Math.PI/2 is down) used in wind mode.

Examples

Standard Hero
<DispersedText text="VECTOR" color="#ffffff" />
Neon Glow & Shapes
<DispersedText text="GLOW" shape="star" color="#00FFCC" glow={true} glowBlur={15} />
Linear Gradient
<DispersedText text="SPECTRUM" colorMode="gradient" gradientColors={["#FF007A", "#7928CA", "#00DFD8"]} />
Velocity Heatmap
<DispersedText text="VELOCITY" colorMode="speed" speedColor="#FF007A" />
Gravity Physics
<DispersedText text="BOUNCE" interactionMode="gravity" />
Give the parent a size. The canvas fills its container (width: 100%; height: 100%). Put it inside a sized parent box (like relative h-96 w-full) and set colors to contrast the surface behind.
Respects user system preferences — falls back automatically to drawing a calm, static dot field of the formed text.
Pre-calculates parsed RGB vectors and employs global memoized color tables to optimize drawing speed. Neon glow uses hardware-accelerated CSS GPU filters rather than canvas shadows for zero-overhead rendering.

Source

export { default as DispersedText } from "./DispersedText";
export type { DispersedTextProps } from "./DispersedText";
View on GitHub →Report an issue