# Dither Gradient

> A bending gradient drawn only in your colours through an ordered dither.

## Spec sheet

| | |
| --- | --- |
| Access | Free: no account, free for commercial use |
| Shelf | Backgrounds › Backgrounds |
| Live preview | https://uibrik.com/components/dither-gradient |
| Writes | 1 files into `components/uibrik/dither-gradient/`, plus `components/uibrik/_shader-background/ShaderSurface.tsx` |
| Packages | none beyond React |
| Needs | React 19, Tailwind CSS v4, a project set up with `npx shadcn@latest init` |
| Theme | Reads the shadcn tokens and follows class-based dark mode ([theming](https://uibrik.com/docs/theming.md)) |
| Updated | Nov 9, 2026 |

## Add it

```bash
npx shadcn@latest add https://uibrik.com/r/dither-gradient.json
```

With the `@uibrik` namespace in `components.json` ([setup](https://uibrik.com/docs/installation.md)): `npx shadcn@latest add @uibrik/dither-gradient`.

Can't run commands? https://uibrik.com/components/dither-gradient/prompt-full.txt has every file verbatim, with the setup steps, ready for an assistant to write.

## Render it

Renders as is; every value shown is the default, so delete any line you don't need.

```tsx
import { DitherGradient } from "@/components/uibrik/dither-gradient/dither-gradient";

const colors = ["#0f1535", "#2747c9", "#21b5a8", "#c8ec6e", "#f8f6e3"];

<DitherGradient
  colors={colors}
  pixelSize={3}
  scale={1}
  warp={1}
  angle={90}
  sweep={0.6}
  speed={1}
  seed={0}
  animate
  interactive
  radius={180}
  follow={0.6}
>
  …
</DitherGradient>
```

## Tune it

The same props as the Customize panel on https://uibrik.com/components/dither-gradient.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `colors` | `string[]` | `["#0f1535","#2747c9","#21b5a8","#c8ec6e","#f8f6e3"]` | The only colours drawn, in order; 2 to 6. |
| `pixelSize` | `number` | `3` | Size of a dither pixel; larger is more retro. |
| `scale` | `number` | `1` | Size of the shapes; larger is calmer. |
| `warp` | `number` | `1` | How much the gradient bends. |
| `angle` | `number` | `90` | Direction the colours run; 90 runs bottom to top. |
| `sweep` | `number` | `0.6` | How far apart the first and last colours sit. |
| `speed` | `number` | `1` | Animation speed; 1 is the designed pace. |
| `seed` | `number` | `0` | Shifts the composition, so two backgrounds with the same settings still differ. |
| `animate` | `boolean` | `true` | Move on its own. Off draws one still frame. |
| `interactive` | `boolean` | `true` | React to the pointer. |
| `radius` | `number` | `180` | How far the pointer light reaches. |
| `follow` | `number` | `0.6` | How lazily the light follows the pointer, 0 (locked) to 1 (drifts after it). |

## Wire it

The props the Customize panel doesn't show: ranges, data, content and callbacks.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `children` | `ReactNode` |  | Content shown on top of the background. |
| `className` | `string` |  | Classes for the box; it fills whatever size you give it. |

## Where it fits

- **Retro brand backgrounds**: An ordered dither drawn only in your colours gives a printed, 1-bit look that stays on brand. Pairs with [Halftone](https://uibrik.com/components/halftone.md).
- **Design tool heroes**: A bending gradient with visible pixels signals craft to a design-literate audience.
- **Covers and dividers**: The pattern works as a band between sections or as a cover image for posts.

## Same shelf: Backgrounds

- [Dot Grid](https://uibrik.com/components/dot-grid.md): A quiet grid of dots lit by a drifting wave and by the cursor.
- [Fluted Glass](https://uibrik.com/components/fluted-glass.md) (Pro): A band of light seen through fluted glass, broken into steep slivers rib by rib.
- [Grain Gradient](https://uibrik.com/components/grain-gradient.md): Colour that folds slowly like silk, finished with film grain.
- [Halftone](https://uibrik.com/components/halftone.md): A screen of lit dots: swirling ribbons of light drawn by the size and brightness of each dot.
- [Halftone Horizon](https://uibrik.com/components/halftone-horizon.md) (Pro): An arched horizon printed in halftone in the dark, where the dots grow with the light until they fuse into a smooth glow.
- [Horizon Gradient](https://uibrik.com/components/horizon-gradient.md): Black fading through deep blue to white in bands that arch like a horizon, breathing slowly.

## Ground rules

- Only the props above exist. To change anything else, edit the installed file.
- Keep the files in `components/uibrik/dither-gradient/` so the import paths keep resolving.
- The playbook for working with the whole library: https://uibrik.com/llms.txt
