---
title: "DotCode"
description: "A code of round dots for cans, bottles, and cartons that an ink jet prints fast. Each dot stands alone, so a smear still reads."
url: https://gelatinui.com/components/dot-code
markdown_url: https://gelatinui.com/components/dot-code.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/dot-code"
version: "2026-11-11"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# DotCode

> A code of round dots for cans, bottles, and cartons that an ink jet prints fast. Each dot stands alone, so a smear still reads.

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

## When to use it

Best for: A lot, date, or serial that a fast ink-jet prints on a can, bottle, or carton.

- Use it when the printer puts dots, not solid modules, on the pack.
- Use `plate={false}` for dots straight on a pack or board color.
- Use `pixelSize` for the outer width. The height follows the symbol.

## When not to use it

- For a product number that every till reads, use a 1D [Barcode](https://gelatinui.com/components/barcode.md).
- For the lot facts on a screen, use a [Data List](https://gelatinui.com/components/data-list.md).

## Notes for agents

- `fit` fills the width of the parent, in whole px a module when that loses one module or less.
- The symbol grows with the data, up to 2,000 characters. The quiet zone is 3 dots.
- The value is plain text: it does not add the GS1 FNC1 for an element string.
- A value it cannot hold shows a help line, not a code. `onError` gets the error.
- `status` sets loading and empty.

## Anatomy

```text
DotCode
```

## API reference

### DotCode

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `aria-label` | `string` |  | Defines a string value that labels the current element. The accessible name. Default the kind ("Data Matrix code"), or "<kind>: <value>" for a link. |
| `value` | `string` |  | The data etiket encodes. The data: a lot, a date, or a serial. Default width 160px. |
| `pixelSize` | `number` |  | The outer width in px, quiet zone included. The height follows the symbol. |
| `fit` | `boolean` |  | Fill the width of the parent, in whole px a module when that loses one module or less (the QR Code rule), else the exact width. Default false. Wide codes (postal, PDF417) on a phone. |
| `plate` | `boolean` |  | The light plate under the code. Default true. |
| `status` | `DataStatus` |  | The load state. Default `ready`. `loading`: the skeleton while the value is not known yet. `empty`: the empty box. `error` shows as `ready`: the error box is for a value the code cannot hold. |
| `labels` | `Partial<CodeSymbolLabels>` |  | The texts of the empty and error states. |
| `onError` | `function` |  | Runs once for each new error (too much data, a character the kind cannot hold), after commit. It does not run again for the same error, and typed values are deferred: a field that shows the error should derive it from the value with the kind's encoder (cached, so free), not clear it on each change. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| DotCode | `dot-code` |  |  |  |

## Usage

Pass the lot line.

```tsx title="lot-code.tsx"
import { DotCode } from "@/components/pro/labels/dot-code";

export function LotCode() {
  return <DotCode value="L2611 BB 30.04.2027 14:32 L3" pixelSize={120} />;
}
```

## 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-pro/dot-code
```

It adds 18 registry items: 17 files, 2218 lines, and the npm packages `@mantine/hooks`, `clsx`, `etiket`, `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

- [Barcode](https://gelatinui.com/components/barcode.md)
- [Data List](https://gelatinui.com/components/data-list.md)
- [Badge](https://gelatinui.com/components/badge.md)

## Accessibility

It is an image named "DotCode" by default. Pass `aria-label` to say what it holds, for example "Lot code L2611".

Print the lot and date as text next to the code, so people can read them too.
