# Wavy Background

> React canvas background of layered sine waves rolling behind your content, with colour, speed, amplitude and blur props, sharp on retina and paused off screen.

- Kind: Motion component (Motion)
- Docs: https://ui.minidev.pro/docs/wavy-background
- Source (registry JSON with the full file): https://ui.minidev.pro/r/wavy-background.json
- License: MIT. One file, yours to edit after install.

## 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.

## Installation

### shadcn CLI (copies the source into your project)

```bash
npx shadcn@latest add @minidev/wavy-background
```

Writes `components/ui/wavy-background.tsx` plus the MiniDev files it is built from (button) and installs its npm dependencies. Older CLI versions: `npx shadcn@latest add https://ui.minidev.pro/r/wavy-background.json`.

### npm package

```bash
npm i minidev-ui-kit lucide-react motion
```

Add the tokens to your global stylesheet once:

```css
@import "tailwindcss";
@import "minidev-ui-kit/styles.css";
@source "../node_modules/minidev-ui-kit";
```

Next.js also needs `transpilePackages: ["minidev-ui-kit"]` in next.config.

## Import

After the shadcn install:

```tsx
import { WavyBackground } from "@/components/ui/wavy-background"
```

From the npm package:

```tsx
import { WavyBackground } from "minidev-ui-kit/premium/wavy-background"
```

## Usage

```tsx
import { WavyBackground } from "@/components/ui/wavy-background"

export function Example() {
  return (
    <WavyBackground />
  )
}
```

## Props

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `colors` | `string[]` | `["var(--chart-2)", "var(--info)", "va...` | no | Colours of the waves, back to front. Any CSS colour, including var(--token). |
| `speed` | `number` | `1` | no | Speed multiplier. 2 is twice as fast, 0.5 half as fast. |
| `amplitude` | `number` | `26` | no | Height of the swell in pixels. |
| `blur` | `number` | `8` | no | Softness in pixels. 0 draws crisp edges. |
| `coverage` | `number` | `0.46` | no | Share of the panel the waves rise to, from the bottom, 0 to 1. |
| `opacity` | `number` | `0.46` | no | Opacity of each wave, 0 to 1. |
| `className` | `string` | - | no |  |
| `children` | `React.ReactNode` | - | no |  |

## Examples

### Your colours

colors are the waves back to front; a larger amplitude and coverage bring the swell higher up the panel.

```tsx
<WavyBackground colors={["var(--accent)", "var(--accent-2)"]} amplitude={40} coverage={0.6} className="h-72">
  <div className="flex h-full flex-col items-center gap-3 px-6 pt-10 text-center">
    <p className="max-w-[18ch] text-3xl font-medium tracking-[-0.035em] text-balance text-fg">Payouts every Friday</p>
    <p className="max-w-sm text-sm text-fg-muted">Northwind pays 40 suppliers a week and Lumen files the remittance advice.</p>
  </div>
</WavyBackground>
```

### Crisp and slow

blur={0} draws hard edges, a low opacity keeps them quiet, and speed below 1 slows the roll.

```tsx
<WavyBackground blur={0} speed={0.4} opacity={0.3} coverage={0.4} colors={["var(--success)", "var(--info)", "var(--chart-2)"]} className="h-64">
  <div className="flex items-start justify-between gap-4 px-8 pt-8">
    <div>
      <p className="text-xs font-medium tracking-[0.06em] text-fg-subtle uppercase">Cash on hand</p>
      <p className="mt-1 text-3xl font-medium tracking-[-0.035em] text-fg tabular-nums">$412,800</p>
    </div>
    <Badge variant="accent">+8.2% this month</Badge>
  </div>
</WavyBackground>
```

### Call to action

Keep the content in the top part with pt-10 and a lower coverage, so the buttons sit above the swell.

```tsx
<WavyBackground amplitude={18} coverage={0.42} opacity={0.6} className="h-72">
  <div className="flex h-full flex-col items-center gap-4 px-6 pt-10 text-center">
    <p className="max-w-[20ch] text-3xl font-medium tracking-[-0.035em] text-balance text-fg">Ready when you are</p>
    <div className="flex flex-wrap items-center justify-center gap-3">
      <Button>Start free trial <ArrowRightIcon /></Button>
      <Button variant="outline">Talk to sales</Button>
    </div>
  </div>
</WavyBackground>
```

## 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.

## FAQ

### 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.

## Rules for generating code

- Use semantic tokens only (bg, surface, sunken, border, fg, fg-muted, fg-subtle, ink, accent, success, warning, danger). Never raw hex or palette steps like blue-500.
- Shadows only from the set: shadow-xs, shadow-sm, shadow-raised, shadow-md, shadow-lg, shadow-overlay.
- Numbers use tabular-nums. Dark mode is the `dark` class on <html>; components never branch on theme.

## Dependencies

- npm: `lucide-react`, `motion`
- Built from: [button](https://ui.minidev.pro/docs/button/md)

## Related

- [Aurora Background](https://ui.minidev.pro/docs/aurora-background/md): React aurora background that drifts soft, blurred bands of accent colour behind a hero, with intensity, speed, blur and colour props. Pauses off screen.
- [Light Field](https://ui.minidev.pro/docs/light-field/md): A WebGL shader background of drifting color silk with a soft cursor light and grain. It renders at half resolution, pauses offscreen and adapts to dark mode.
- [Meteors](https://ui.minidev.pro/docs/meteors/md): React meteors background that sends accent colored streaks with fading tails falling diagonally behind your content, with count, angle and speed props.
- [Particles](https://ui.minidev.pro/docs/particles/md): React canvas background of drifting particles that repel or attract around the pointer, colored from your accent token and sharp on high density screens.
- [Waveform Hero](https://ui.minidev.pro/docs/waveform-hero/md): A hero with an audio waveform of hairline bars that pulse in a staggered loop, a headline, copy and a magnetic CTA. Bars hold still for reduced motion.
- [Animated Feature Row](https://ui.minidev.pro/docs/animated-feature-row/md): A row of feature cards that slide up with a staggered delay when scrolled into view. Pass title and description pairs; reduced motion keeps them still.

---

All 557 components: https://ui.minidev.pro/llms.txt (full text: https://ui.minidev.pro/llms-full.txt).
