Controls

Distortion Wave

Preview
Reduced motion

Simulates prefers-reduced-motion for the demo. Off follows your system setting.

Keyboard stepping

Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.

Distortion Wave
24°Sunny in Lisbon
  • 2 PM22°
  • 4 PM24°
  • 6 PM25°
  • 8 PM24°
  • 10 PM21°
Night DriveNeon Coast
0:00 / 3:58
StudioFor growing teams

$12/ month

Billed monthly. Cancel anytime.
  • Unlimited projects
  • Priority support
  • Custom domains
  • Team analytics
Mira SolSound designer, Lisbon
Followers
12.4k
Following
318

Distortion Wave

A wrapper that plays a WebGL wave across its contents whenever they change.

Dependencies

distortion-wave

Installation

npx shadcn@latest add @pixel-ui-pro/distortion-wave

How to use

import { useState } from "react";
import { DistortionWave, useWave } from "@/components/ui/distortion-wave";
function LikeButton() {
const wave = useWave();
const [liked, setLiked] = useState(false);
return (
<button
onClick={(e) =>
// source: where the wave starts; focus: the touch point it leans toward
wave(() => setLiked(!liked), { source: e.currentTarget, focus: e })
}
>
{liked ? "Liked" : "Like"}

Source Code

The source comes with Pro. Install it with your license key and the file is yours to edit.

Get Pro

Props

Options you can pass to customize this component.

Prop
Type
Description
children*
ReactNode

The content the wave plays across. Call useWave() inside it to get wave(update, options).

palette
auroraoceanmintemberelectricpixel

A named palette or up to 8 hex colours for the wave.

effect
"wave"Effect

The look of the wave. Import others from distortion-wave, such as electric from distortion-wave/electric.

duration
number

Length in ms. By default it scales with the size of the wrapper.

easing
string | [number, number, number, number] | (t: number) => number

How the wave front travels, like a CSS easing.

intensity
number

Strength of the distortion. 0 keeps only the colours.

particles
booleannumber

Set false to drop the particles, or a number for a particle count.

className
string

Classes applied to the wrapper div.