---
title: "Royal Mail Barcode"
description: "The barcode on UK letters that Royal Mail sorts by machine. It holds the postcode and the delivery point, with a check character."
url: https://gelatinui.com/components/royal-mail-barcode
markdown_url: https://gelatinui.com/components/royal-mail-barcode.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/royal-mail-barcode"
version: "2026-11-11"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Royal Mail Barcode

> The barcode on UK letters that Royal Mail sorts by machine. It holds the postcode and the delivery point, with a check character.

Page: https://gelatinui.com/components/royal-mail-barcode

## When to use it

Best for: UK letters that need machine sorting by postcode and delivery point.

- Pass the postcode and the 2-character Delivery Point Suffix in `value`: "SN13LJ1A".
- Put it under the address block, on white paper with `plate={false}`.
- Use `fit` in a narrow column or a card: the code fills the width of its parent, in whole px a bar where it can. `pixelSize` sets a fixed width.

## When not to use it

- For a parcel tracking number or an order number, use the Free [Barcode](https://gelatinui.com/components/barcode.md).
- For the address text that people read, use [Address Display](https://gelatinui.com/components/address-display.md).

## Notes for agents

- Royal Mail assigns the Delivery Point Suffix (DPS) of each address in its address file: take it from the address data, never make it up.
- Spaces drop and letters turn upper case. A hyphen or any character that is not A to Z or 0 to 9 shows a help line, not bars. `onError` gets the error.
- The check character goes in for you.
- The bars have no text. The address block prints the postcode for people.

## Anatomy

```text
RoyalMailBarcode
```

## API reference

### RoyalMailBarcode

| 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 postcode and the Delivery Point Suffix, with no space: "SN34RD1A". |
| `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 |
| --- | --- | --- | --- | --- |
| RoyalMailBarcode | `royal-mail-barcode` |  |  |  |

## Usage

Pass the postcode and the Delivery Point Suffix, with no space.

```tsx title="letter-code.tsx"
import { RoyalMailBarcode } from "@/components/pro/labels/royal-mail-barcode";

export function LetterCode() {
  return <RoyalMailBarcode value="SN13LJ1A" plate={false} />;
}
```

## 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/royal-mail-barcode
```

It adds 18 registry items: 17 files, 2224 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

- [Address Display](https://gelatinui.com/components/address-display.md)
- [Barcode](https://gelatinui.com/components/barcode.md)
- [Choice Card](https://gelatinui.com/components/choice-card.md)

## Accessibility

It is an image, named "Royal Mail barcode" by default. Pass `aria-label` to say what it is, for example "Royal Mail barcode for SN1 3LJ".

The bars have no text: keep the address as text next to it.
