Wavy Background
MotionReact canvas background of layered sine waves rolling behind your content, with colour, speed, amplitude and blur props, sharp on retina and paused off screen.
Installation
npx shadcn@latest add @minidev/wavy-background
MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/wavy-background.json
Usage
import { WavyBackground } from "@/components/ui/wavy-background"
export function Example() {
return (
<WavyBackground />
)
}
API reference
| Prop | Type | Default |
|---|---|---|
| colorsColours of the waves, back to front. Any CSS colour, including var(--token). | string[] | ["var(--chart-2)", "var(--info)", "va... |
| speedSpeed multiplier. 2 is twice as fast, 0.5 half as fast. | number | 1 |
| amplitudeHeight of the swell in pixels. | number | 26 |
| blurSoftness in pixels. 0 draws crisp edges. | number | 8 |
| coverageShare of the panel the waves rise to, from the bottom, 0 to 1. | number | 0.46 |
| opacityOpacity of each wave, 0 to 1. | number | 0.46 |
| className | string | - |
| children | React.ReactNode | - |
When to use
Use it behind a hero, footer or sign-up panel. Reach for AuroraBackground for a CSS-only gradient, LightField for a WebGL glow, and Meteors or Particles for small moving points.
Accessibility
- The canvas is
aria-hidden; children render above it. - Under reduced motion it draws one still frame.
- It stops drawing when off screen or in a background tab.
Frequently asked questions
How do I make the waves cover more of the panel?
coverage is the share of the height the waves rise to from the bottom, 0 to 1 (default 0.46). amplitude sets the swell in pixels and blur the softness; blur={0} draws crisp edges.
Do the wave colours follow the theme?
Yes. colors accept var(--token) values, which are resolved through the cascade and re-read when the theme or material changes. Pass them back to front.
Dependencies
npm
Built from
Examples
Your colours
colors are the waves back to front; a larger amplitude and coverage bring the swell higher up the panel.
Crisp and slow
blur={0} draws hard edges, a low opacity keeps them quiet, and speed below 1 slows the roll.
Call to action
Keep the content in the top part with pt-10 and a lower coverage, so the buttons sit above the swell.