---
title: "Intelligent Mail Barcode"
description: "The barcode on US letters and flats for USPS tracking and lower prices. It holds the 20-digit tracking code and the ZIP code in 65 bars."
url: https://gelatinui.com/components/intelligent-mail-barcode
markdown_url: https://gelatinui.com/components/intelligent-mail-barcode.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/intelligent-mail-barcode"
version: "2026-11-11"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Intelligent Mail Barcode

> The barcode on US letters and flats for USPS tracking and lower prices. It holds the 20-digit tracking code and the ZIP code in 65 bars.

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

## When to use it

Best for: US letters and flats that need USPS tracking and automation prices.

- Pass the 20-digit tracking code in `value`: barcode ID, service type, mailer ID, and serial.
- Pass the ZIP of the address in `routing`: 5, 9, or 11 digits (ZIP+4 and the 2-digit delivery point), or none.
- Print it on white paper with `plate={false}`, next to the address block.
- 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

- USPS assigns the mailer ID, and the mailer keeps each serial unique in its window: never make them up for real mail. Take them from the app settings.
- The bars have no text. The address block prints the ZIP for people.
- Spaces and hyphens drop from `value` and `routing`. Any other length shows a help line, not bars. `onError` gets the error.
- The second digit of the barcode ID must be 0 to 4. Any other digit shows a help line.
- `pixelSize` is the outer width with the quiet zone. In a 375px column, use `fit`, so the code never gets wider than its parent.

## Anatomy

```text
IntelligentMailBarcode
```

## API reference

### IntelligentMailBarcode

| 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 20-digit tracking code: barcode ID, service type, mailer ID, and serial. |
| `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. |
| `routing` | `string` | "" | The routing ZIP code: none, 5, 9, or 11 digits. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| IntelligentMailBarcode | `intelligent-mail-barcode` |  |  |  |

## Usage

Pass the tracking code and the routing ZIP of the address.

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

export function LetterCode() {
  return (
    <IntelligentMailBarcode
      value="00270123456000048213"
      routing="94109162103"
      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/intelligent-mail-barcode
```

It adds 18 registry items: 17 files, 2239 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)
- [Data List](https://gelatinui.com/components/data-list.md)

## Accessibility

It is an image, named "Intelligent Mail barcode" by default. Pass `aria-label` to say what it is, for example "Intelligent Mail barcode for ZIP 94109-1621".

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