---
title: "Dot Matrix"
description: "A grid of small cells that light up in a pattern while something loads, and turn into a check or an x when the work ends."
url: https://gelatinui.com/components/dot-matrix
markdown_url: https://gelatinui.com/components/dot-matrix.md
access: free
install: "npx shadcn@latest add @gelatin-ui/dot-matrix"
registry_item: https://gelatinui.com/r/dot-matrix.json
version: "2026-11-09"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Dot Matrix

> A grid of small cells that light up in a pattern while something loads, and turn into a check or an x when the work ends.

Page: https://gelatinui.com/components/dot-matrix

## When to use it

Best for: A loader that shows AI work or a running job, and ends with a check or an x.

- Pick one of the `pattern` values to match the feel of your product.
- Set `state` to `done` or `error` when the work ends. Add `text-success` or `text-destructive` for color.
- Name it with `aria-label`, or set `aria-hidden` when a text label is next to it.
- Set `colors` to two or more colors for a gradient over the cells, and `gradient` for its direction.

## When not to use it

- For a plain loading ring in a button or a field, use a [Spinner](https://gelatinui.com/components/spinner.md).
- For a task with a known share done, use a [Progress](https://gelatinui.com/components/progress.md).

## Notes for agents

- It is an `<output>` (role `status`). It takes the current text color in every state, unless `colors` is set.
- `colors` takes any CSS colors or tokens (`var(--info)`). Each cell mixes the two colors around its place in OKLCH. One color paints every cell. `gradient` is `diagonal` (default), `horizontal`, `vertical`, or `radial`.
- `grid` sets 3, 4, or 5 cells on each side. `size` sets the box from `xs` to `xl`.
- `speed` changes the loop speed: 2 is twice as fast. `paused` holds the frame.
- The loop pauses off screen and in a hidden tab. The server renders the first frame.

## Anatomy

```text
DotMatrix
```

## API reference

### DotMatrix

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "lg" \| "sm" \| "xl" \| "xs"` |  |  |
| `pattern` | `"border" \| "checker" \| "columns" \| "converge" \| "corners" \| "fill" \| "heartbeat" \| "pulse" \| "radar" \| "rain" \| "ripple" \| "scan" \| "snake" \| "spiral" \| "twinkle" \| "wave"` | "twinkle" | How the cells light up. Default `twinkle`. |
| `grid` | `DotMatrixGrid` | 3 | Cells on each side: 3 (default), 4, or 5. |
| `state` | `DotMatrixState` | "running" | `running` (default) loops; `paused` holds the frame at 40%; `done` and `error` turn the cells into a check or an x, in the same color (add `text-success` or `text-destructive` for color). |
| `speed` | `number` | 1 | Loop speed: 2 is twice as fast. Default 1 (one loop in 1.6s, the `flow` kind). |
| `colors` | `readonly string[]` |  | The colors of the cells, as gradient stops: any CSS color, a token too (`var(--color-info)`). One color paints every cell. Default: the text color. |
| `gradient` | `"diagonal" \| "horizontal" \| "radial" \| "vertical"` | "diagonal" | How the `colors` lie over the cells: `diagonal` (default), `horizontal`, `vertical`, `radial`. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| DotMatrix | `dot-matrix` | `data-off`, `data-state` | `--dot-matrix-color`, `--dot-matrix-grid`, `--dot-matrix-size` | `motion-timing` |

## Usage

Import Dot Matrix and compose its parts.

```tsx title="dot-matrix.tsx"
import { DotMatrix } from "@/components/effects/dot-matrix";

export function DotMatrixDemo() {
  return <DotMatrix size="xl" />;
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/dot-matrix
```

It adds 14 registry items: 12 files, 2529 lines, and the npm packages `@mantine/hooks`, `motion`, `tailwind-merge`, `tailwind-variants`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Spinner](https://gelatinui.com/components/spinner.md)
- [Progress](https://gelatinui.com/components/progress.md)
- [Skeleton](https://gelatinui.com/components/skeleton.md)

## Motion

| Part | Motion |
| --- | --- |
| Loop | flow · one loop in 1.6s; only the opacity of each cell moves |
| End | fade · the cells turn into a check or an x from the light each cell shows |
