Skip to content

shadcn.io is an independent project built on shadcn/ui

Pro

Wavy Background for Solid

Thick, soft bands of color cross the box in slow waves. For Solid with Ark UI, when a hero wants color under the headline.

On this page10 sections
UI library: Ark UI

Thick, soft bands of color cross the box in long, slow waves and weave through one another. Each band is a stroke along a line that slow noise keeps reshaping, drawn by a GLSL scene on WebGL2 with no dependency: it keeps its width where the line climbs, the far bands are thinner, softer and dimmer, and each runs a little into the next color along its length. The scene reads the surface behind it, so crossings deepen like ink on a light page and glow on a dark one, and the bands bow slightly toward the pointer.

Use it under the copy of a hero, across a pricing band or at the foot of a card. For wide satin ribbons that twist and catch the light, use Ribbons; for filled hills of light rising from the bottom edge, Light Waves; for hairlines with a light traveling along each, Paths. With reduced motion it holds one still frame.

Playground
Wavy Background, still
Customize

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Usage

import { Wavy } from "@/components/ui/wavy";
<Wavy class="flex min-h-[36rem] flex-col items-center pt-20">
  <h1 class="text-5xl font-semibold">Mix a whole record in your browser</h1>
</Wavy>

Wavy is a container: whatever you put inside sits on top of the bands, in normal flow. It fills its own box, so give it a height or content. By default the bundle crosses the lower part of the box (placement="bottom"), which leaves the top for copy. For a backdrop behind the whole page, render it empty with className="fixed inset-0 -z-10".

Presets

Tidethe default lookTry it
<Wavy />
LagoonTry it
<Wavy
  amplitude={1.3}
  colors={["#a7f3d0", "#34d399", "#2dd4bf", "#38bdf8"]}
  count={4}
  frequency={1.4}
  placement="top"
/>
MistTry it
<Wavy
  blur={1}
  colors={["#a5b4fc", "#c4b5fd", "#f9a8d4"]}
  count={3}
  depth={0.2}
  placement="center"
  speed={0.6}
  spread={1.6}
  thickness={2}
/>
MonoTry it
<Wavy
  blur={0.4}
  colors={["var(--muted-foreground)", "var(--foreground)"]}
  count={4}
  intensity={0.6}
  thickness={0.5}
/>
Sashthe default lookTry it
<Wavy angle={28} count={6} placement="center" spread={2} />
Strandsthe default lookTry it
<Wavy
  blur={0.2}
  count={6}
  intensity={1.2}
  placement="center"
  thickness={0.25}
/>
SunsetTry it
<Wavy
  amplitude={1.4}
  angle={-14}
  colors={["#fbbf24", "#fb923c", "#f43f5e", "#c026d3"]}
  count={4}
  placement="center"
/>

Each preset is a set of props, so copy one and keep tuning. Tide is the default. Mist turns three bands into one wide, fully feathered haze for a quiet section, Strands thins six of them into crisp lines through the middle, Sash tilts the bundle into a diagonal, and Mono takes its two colors from your theme.

Examples

Hero

The bundle crosses the lower part of the box, so the badge, the headline, the copy and the two buttons sit in the upper half on the plain surface. No prop is set. The chip and the second button have a translucent ground of their own for the frames where a crest reaches them.

Preview width

Colors

colors runs from the farthest band to the nearest: here amber and orange behind rose and magenta, on a dark surface. placement="center" puts the bundle through the middle, angle={-14} tips it down to the right and amplitude={1.4} lets the four bands swing wider.

Preview width

In a card

The same scene in a 24rem card: the bands scale with the box, so they stay in proportion. count={4} thins the bundle a little, and grain={0.2} adds film grain over it. The title and the line under it sit at the top, clear of the bands.

Preview width

Customization

Every color is a CSS color, so a theme variable works and follows a theme switch: colors={["var(--chart-1)", "var(--chart-2)", "var(--chart-3)"]}. Keep neighbors in the list close in hue, since each band runs into the next color along its length. thickness, blur and depth shape the bands, amplitude, frequency and spread shape the bundle, and seed gives another arrangement.

The surface is the root's own background, bg-background by default. Give the root another (bg-slate-950, bg-amber-50) and the bands adapt: on a light surface they multiply into it like ink, on a dark one they add light. fade masks an edge, opacity turns the whole effect down, and grain adds film grain.

<Wavy
  class="min-h-[32rem] bg-slate-950"
  colors={["var(--chart-1)", "var(--chart-2)", "var(--chart-3)"]}
  count={3}
  fade="right"
  placement="center"
/>

Performance

It's one WebGL2 canvas and one fragment shader. Each pixel samples two slices of simplex noise for every band, eight bands at most, and only the pixels inside a band pay for its slope and its color (three more samples). It draws only while it's on screen and the tab is visible, shares one frame loop with every other background on the page, and lowers its own resolution if frames run long. quality sets the render scale yourself, and paused holds the frame.

Accessibility

The bands are decoration: the canvas is hidden from assistive tech and lets every click through to your content. With reduced motion it draws one still frame and ignores the pointer. Nothing flashes.

Keep copy off the bundle, or give it a ground of its own. On the default palette the worst spots measure 3.1:1 for text-foreground on a light surface (the deepest crossing) and 2.3:1 on a dark one (the brightest), both under the 4.5:1 body text needs. That's why the default sits low: the upper half of the box stays the plain surface, where the same text keeps its full contrast.

FAQ

How do I change the colors?

Pass two to eight CSS colors to colors. They go to the bands in order, from the farthest to the nearest, and the list repeats when there are more bands than colors. Hex, oklch() and theme variables such as var(--chart-1) all work, and a variable follows your theme when it changes.

Does it work on a light page?

Yes, with no prop to set. The scene reads the color behind it. On a light surface the bands behave like translucent ink, so two that cross make a deeper color. On a dark surface they behave like light, and a near band dims the ones behind it so a crossing keeps its hue. Set the surface with a class on the component, such as bg-slate-950.

Can I put the headline right on the waves?

You can, with placement="center", but check the contrast: a crossing of two bright bands is too light for white text and too deep for black text. Lower intensity to around 0.5, raise blur to 1, or give the headline's block a bg-background/60 backdrop-blur ground. The default keeps the bundle low so the copy above it needs none of that.

Why do the bands get wider in a bigger box?

Their width follows the box, not the screen: a band is about a tenth of the box's shorter side at thickness={1}, so a card and a full page show the same picture at their own size. In a wide box the swells stretch with the width, which keeps them long and calm. Use thickness and frequency to change either.

How do I put it behind the whole page?

Render it empty with className="fixed inset-0 -z-10". It still follows the pointer there, since it listens on the window. To put it behind one section, wrap that section's content in it and give it a height, such as min-h-svh.

Will it slow my page down?

It's a light shader: ten to sixteen noise samples a pixel outside the bands and a few more inside them, on the GPU, and nothing at all while it's off screen or the tab is hidden. If a device can't keep up, it renders fewer pixels by itself. For a phone-first page, quality={0.75} draws a little over half the pixels, and soft bands hide the difference.

Does it work with Next.js and server components?

Yes. Import it into a server component and it renders its box and your content on the server; the canvas starts in the browser and fades in over the surface. It needs WebGL2, which every current browser has. Without it the box keeps its background, or the fallback you pass.

What happens with reduced motion?

It draws one still frame of the bands and stops, and the pointer no longer moves them. The frame is the same one every time, so the page looks the same on each visit. paused does the same on demand, and speed={0} holds whatever frame is showing.

API Reference

Wavy

data-slot="wavy"

PropType
amplitude?number

How far each band swings away from its own line.

Default
1
angle?number

The tilt of the bands, in degrees from -45 to 45: positive rises to the right.

Default
0
blur?number

How soft the bands' edges are, from 0 (cut clean) to 1 (all feather).

Default
0.75
colors?string[]

Two to eight CSS colors, one a band from the farthest to the nearest; each band also runs into the next color along its length. Theme variables such as var(--chart-1) follow your theme.

Default
["#22d3ee", "#38bdf8", "#6366f1", "#a855f7", "#ec4899"]
count?number

How many bands cross the box, from 1 to 8.

Default
5
depth?number

How much the bands differ with distance, from 0 (all alike) to 1 (the far ones thin, soft and dim, the near ones wide and bright).

Default
0.6
fade?"none" | "radial" | "top" | "bottom" | "left" | "right"

Which edges fade out to the surface: radial keeps the middle, the others name the side that fades.

Type
"none" | "radial" | "top" | "bottom" | "left" | "right"
Default
"none"
fallback?string

What shows until the first frame and in browsers without WebGL2: a CSS background value that looks like the scene.

frequency?number

How many swells a band makes across the box: higher packs more of them.

Default
1
grain?number

Film grain over the scene, from 0 to 1.

Default
0
intensity?number

How strongly the bands show.

Default
1
interactive?boolean

Whether the scene follows the pointer and answers a press. Touch never moves it, so scrolling a page on a phone isn't disturbed.

Default
true
opacity?number

How strongly the scene shows over the surface, from 0 to 1.

Default
1
paused?boolean

Holds the current frame.

Default
false
placement?"bottom" | "center" | "top"

Where the bundle crosses the box: the lower part, the middle or the upper part.

Type
"bottom" | "center" | "top"
Default
"bottom"
quality?number

Render scale, from 0.25 to 1, of the screen's pixels (capped at 2×). Lower is cheaper and softer.

Default
1
seed?number

Another arrangement of the same bands, from 0 to 20.

Default
0
speed?number

Animation speed: 1 is normal, 0 holds the frame.

Default
1
spread?number

How far apart the bands' own lines sit, from 0 (one braid) to 2 (wide apart).

Default
1
thickness?number

How wide the bands are, as a share of the designed width, which follows the size of the box.

Default
1
time?number

A fixed moment, in seconds: draws it and doesn't animate.