Weight Wave Text
Per-character variable-font wave that drives wght, wdth, and slnt through spring physics across pointer proximity, idle breathing, and scroll modes.
Variable weight in motion
Sweep your pointer across the letters, or scroll on touch devices.
Customize
Installation
npx shadcn@latest add @kinetic/weight-wave-textUsage
Pass a headline or short phrase to text. Each grapheme tracks its own weight (wght), width (wdth), and slant (slnt) springs via stepSpring, creating an organic typographic wave without layout jitter.
import { WeightWaveText } from "@/components/kinetic/ui/weight-wave-text";
interface WaveHeadlineProps {
readonly headline: string;
}
export function WaveHeadline({ headline }: WaveHeadlineProps) {
return (
<WeightWaveText
as="h1"
text={headline}
className="text-4xl tracking-tight"
/>
);
}Modes and variable font axes
Choose how the wave is driven with mode:
"auto"(default): runs a gentle idle breathing wave on desktop whenbreathingistrue, hands off seamlessly to cursor proximity withinradiusPxon fine pointers, and switches to a scroll-linked wave on touch and coarse pointers."pointer": reacts strictly to fine-pointer proximity without idle breathing."breathing": runs the continuous spring-smoothed breathing wave without pointer tracking."scroll": maps wave position to page scroll or an explicitscrollContainerRefon all devices.
Tune the typographic range with minWeight (default 300, clamped 100 to 900), maxWeight (default 850, clamped to 1000), minWidth (default 92), maxWidth (default 112), and maxSlant (default -10, clamped -24 to 24). By default synthesizeAxes={true} pairs font-variation-settings with subtle scaleX and skewX transforms so single-axis variable fonts still convey width and slant changes; set synthesizeAxes={false} when your font natively supports all three axes.
"use client";
import { useRef } from "react";
import {
WeightWaveText,
type WeightWaveTextMode,
} from "@/components/kinetic/ui/weight-wave-text";
interface VariableBannerProps {
readonly label: string;
readonly mode: WeightWaveTextMode;
}
export function VariableBanner({ label, mode }: VariableBannerProps) {
const scrollRef = useRef<HTMLDivElement>(null);
return (
<div ref={scrollRef} className="max-h-72 overflow-y-auto py-16">
<WeightWaveText
as="h2"
text={label}
mode={mode}
minWeight={350}
maxWeight={850}
minWidth={90}
maxWidth={114}
maxSlant={-12}
radiusPx={180}
stiffness={260}
damping={24}
synthesizeAxes={true}
scrollContainerRef={scrollRef}
className="text-3xl tracking-tight"
/>
</div>
);
}Imperative control
Attach a WeightWaveTextHandle ref to trigger a one-shot wave sweep across the phrase with pulse() or immediately restore every character to its resting minWeight and neutral width with reset().
"use client";
import { useRef } from "react";
import {
WeightWaveText,
type WeightWaveTextHandle,
} from "@/components/kinetic/ui/weight-wave-text";
export function ControlledWeightWave() {
const waveRef = useRef<WeightWaveTextHandle>(null);
return (
<div className="flex flex-col items-start gap-4">
<WeightWaveText
ref={waveRef}
text="Kinetic typography"
mode="pointer"
breathing={false}
className="text-3xl tracking-tight"
/>
<div className="flex gap-2">
<button type="button" onClick={() => waveRef.current?.pulse()}>
Pulse
</button>
<button type="button" onClick={() => waveRef.current?.reset()}>
Reset
</button>
</div>
</div>
);
}Accessibility and reduced motion
WeightWaveText renders through SplitText with unit="char", placing the full string (or a custom aria-label) in a single .sr-only span while hiding split visual glyph spans with aria-hidden="true" so screen readers read natural words instead of individual characters.
The spring loop pauses automatically whenever the element scrolls out of view (IntersectionObserver) or the browser tab is hidden (visibilitychange), and speed scales with the global Kinetic tempo. Under reduced motion, WeightWaveText cancels the loop immediately and locks every character at resting minWeight with no font-variation-settings or CSS transform.
API Reference
WeightWaveText
Per-character variable-font wave driven by spring physics across pointer, breathing, and scroll modes.
| Prop | Type | Default | Description |
|---|---|---|---|
text | string | - | Headline or phrase to animate. |
mode | "auto" | "pointer" | "breathing" | "scroll" | "auto" | Interaction driver. Auto uses pointer plus breathing on desktop and scroll on touch devices. |
breathing | boolean | true | Runs a continuous spring-smoothed wave while no pointer is hovering. |
minWeight | number | 300 | Resting wght axis value. |
maxWeight | number | 850 | Peak wght axis value at the wave crest. |
minWidth | number | 92 | Resting wdth axis percentage. |
maxWidth | number | 112 | Peak wdth axis percentage. |
maxSlant | number | -10 | Peak slnt axis angle in degrees. |
radiusPx | number | 160 | Pointer influence radius in pixels. |
synthesizeAxes | boolean | true | Applies subtle scaleX and skewX synthesis alongside font-variation-settings for single-axis fonts. |
speed | number | 1 | Speed multiplier combined with global tempo. |