# Dither Wave

> A sea of color whose edge breaks into dots on a slow tide.

Source: https://www.honestui.com/docs/shaders/dither-wave

<ComponentPreview name="dither-wave-demo" />

## Overview [#overview]

Dither Wave fills the top of a section with color and lets its lower edge break into a grid of dots. The edge rises and falls like a slow tide, with a paler line of foam moving a little behind it.

It is drawn with SVG filters instead of a canvas, so it needs no WebGL and appears with the first paint of a server-rendered page. The wave stretches to its container while the dots keep their size. The area below the wave uses your page background, so it blends into the section that follows in light and dark themes.

Use it as a hero with the heading over the solid part of the wave, or as the top of a launch page.

## Installation [#installation]

<CommandBlock commands="[&#x22;honestui&#x22;]" />

## Usage [#usage]

```tsx
import { DitherWave } from "honestui/shaders"

<DitherWave className="min-h-[600px]">
  <div className="px-8 pt-26 text-center text-white">
    <h1 className="text-4xl leading-[1.06] font-medium tracking-[-0.04em] sm:text-[52px]">
      Ship on calm water.
    </h1>
    <p className="mx-auto mt-4 max-w-95 text-[15px] leading-normal">
      Plan, review, and release from one place.
    </p>
  </div>
</DitherWave>
```

### Colors [#colors]

`color` is the sea; its darker and paler tones are mixed from it. `backgroundColor` is the area below. Both accept any CSS color, including custom properties.

```tsx
<DitherWave color="var(--primary)" backgroundColor="var(--card)" className="h-96" />
```

## Accessibility [#accessibility]

Dither Wave is decorative and its drawing is hidden from assistive technology. Keep text and actions in normal HTML, in roughly the upper third where the color is solid, and check their contrast against your `color`.

The tide stops when the user prefers reduced motion, and the wave stays in place.

## API Reference [#api-reference]


  ### `color`

type: `string` · default: `&#x22;#2563ff&#x22;`

Color of the sea. Any CSS color.

  ### `backgroundColor`

type: `string` · default: `&#x22;var(--background, #fff)&#x22;`

Color behind the wave, which the pale edge and the foam fade toward.

  ### `dotSize`

type: `number` · default: `5`

Distance between dots in CSS pixels, at least 2.

  ### `softness`

type: `number` · default: `30`

How far the edge dissolves into dots, in CSS pixels. 0 is a hard edge.

  ### `foam`

type: `boolean` · default: `true`

Draw the pale second wave below the first.

  ### `speed`

type: `number` · default: `1`

Speed of the tide. 0 holds it still.

  ### `paused`

type: `boolean` · default: `false`

Holds the tide where it is.

  ### `className`

type: `string`

Class for sizing and positioning the container.

  ### `children`

type: `ReactNode`

Content rendered above the wave.
