Simulates prefers-reduced-motion for the demo. Off follows your system setting.
Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.
1
$12/ month
Billed monthly. Cancel anytime.A wrapper that plays a WebGL wave across its contents whenever they change.
npx shadcn@latest add @pixel-ui-pro/distortion-waveimport { useState } from "react";import { DistortionWave, useWave } from "@/components/ui/distortion-wave";function LikeButton() {const wave = useWave();const [liked, setLiked] = useState(false);return (<buttononClick={(e) =>// source: where the wave starts; focus: the touch point it leans towardwave(() => setLiked(!liked), { source: e.currentTarget, focus: e })}>{liked ? "Liked" : "Like"}
The source comes with Pro. Install it with your license key and the file is yours to edit.
Get ProOptions you can pass to customize this component.
children*ReactNodeThe content the wave plays across. Call useWave() inside it to get wave(update, options).
paletteauroraoceanmintemberelectricpixelA named palette or up to 8 hex colours for the wave.
effect"wave"EffectThe look of the wave. Import others from distortion-wave, such as electric from distortion-wave/electric.
durationnumberLength in ms. By default it scales with the size of the wrapper.
easingstring | [number, number, number, number] | (t: number) => numberHow the wave front travels, like a CSS easing.
intensitynumberStrength of the distortion. 0 keeps only the colours.
particlesbooleannumberSet false to drop the particles, or a number for a particle count.
classNamestringClasses applied to the wrapper div.