# Dither glow

A soft dithered spotlight from an edge, a corner or any point, for heroes, pricing cards and quiet section backgrounds.

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. The dithercn agent skill, for building any dither on the engine, is at [/.well-known/agent-skills/dithercn/SKILL.md](/.well-known/agent-skills/dithercn/SKILL.md).

<ComponentPreview src="examples/dither-glow-demo.tsx" size="full" align="stretch" controls="ditherGlowControls">
  <DitherGlowDemo />
</ComponentPreview>

## Installation [#installation]

<InstallBlock name="dither-glow" />

## Usage [#usage]

```tsx
import { DitherGlow } from "@/components/dithercn/dither-glow";

export function Hero() {
  return (
    <section className="relative isolate min-h-[480px]">
      <DitherGlow position="top" className="absolute inset-0 -z-10" />
      <h1>Your headline</h1>
    </section>
  );
}
```

The glow fills its box and shines from `position`. It uses `bayer8`, whose 64 tones keep the falloff smooth. Its centre is brightest and it falls off softly, with a slow breath and a little noise at the edge so it never looks like a flat circle.

## Examples [#examples]

### Rising behind a headline [#rising-behind-a-headline]

With `position="bottom"` the light sits just below the edge, so only its top shows. The headline sits near the top, on clean paper.

<ComponentPreview src="examples/dither-glow-hero.tsx" size="lg" align="stretch">
  <DitherGlowHero />
</ComponentPreview>

### Corner of a card [#corner-of-a-card]

A corner glow is the quietest way to lift one card out of a row. Setting `--dither-paper` to the card's background blends the glow into it, and `bayer8` gives a finer grain at small sizes.

<ComponentPreview src="examples/dither-glow-corner.tsx">
  <DitherGlowCorner />
</ComponentPreview>

### Any point, any palette [#any-point-any-palette]

`position` also takes `[x, y]` as fractions of the box. With a longer palette the glow steps through each colour from its edge to its core.

<ComponentPreview src="examples/dither-glow-palette.tsx" size="lg" align="stretch">
  <DitherGlowPalette />
</ComponentPreview>

## Props [#props]

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `position` | `"top" \| "bottom" \| "left" \| "right" \| "center" \| "top-left" \| "top-right" \| "bottom-left" \| "bottom-right" \| [x: number, y: number]` | `"top"` | Where the light comes from. Edges sit just outside the box; a point is measured from the top left. |
| `radius` | `number` | `0.7` | How far the light reaches. 1 reaches the farthest corner. |
| `intensity` | `number` | `0.75` | Brightness at the centre, from 0 (none) to 1 (full ink). |
| `palette` | `[DitherColor, DitherColor, ...DitherColor[]]` | `["--dither-paper", "--dither-ink"]` | Colours from paper to ink: palette names such as "blue", CSS variable names, or any CSS colour. |
| `matrix` | `"bayer2" \| "bayer4" \| "bayer8" \| "blue-noise"` | `"bayer8"` | The threshold pattern. See Dither engine. |
| `cell` | `number` | `--dither-cell` | Size of one dither cell in CSS pixels. |
| `speed` | `number` | `1` | How fast it moves. |
| `animate` | `boolean` | `true` | false draws one still frame. |
| `className` | `string` | `–` | Size and position. The background fills this box. |

## Notes [#notes]

* It is decorative and hidden from assistive technology. Put real text on top of it, not inside it.
* With reduced motion turned on, it draws one still frame and stops.
* It pauses when scrolled out of view or when the tab is hidden, and releases its WebGL context when far offscreen. Without WebGL it shows a CSS approximation in the same colours.
* It costs one small draw per frame at 30 fps, at one pixel per dither cell. See [Performance](/docs/engine/performance).