---
title: "Japan Post Barcode"
description: "The barcode on Japanese letters and postcards for the Japan Post discount. It holds the postcode and the block, house, and room numbers."
url: https://gelatinui.com/components/japan-post-barcode
markdown_url: https://gelatinui.com/components/japan-post-barcode.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/japan-post-barcode"
version: "2026-11-11"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Japan Post Barcode

> The barcode on Japanese letters and postcards for the Japan Post discount. It holds the postcode and the block, house, and room numbers.

Page: https://gelatinui.com/components/japan-post-barcode

## When to use it

Best for: Japanese letters and postcards that need the barcode discount of Japan Post.

- Pass the 7-digit postcode in `value`, with or without the hyphen: "150-0002". Full-width digits and hyphens ("１５０－０００２") also go in.
- Pass the block, house, and room numbers in `address`: "3-21-2-804". With no `address`, the code holds the postcode alone.
- 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

- `address` takes digits, hyphens, and A to Z only: pass the numbers of the address, not the Japanese text ("3-21-2", not "渋谷3-21-2"). Keep the numbers next to the address text in your data.
- Japan Post sets the rules for which address numbers go in the code: check the address data before a real mailing.
- Full-width digits and hyphens in `value` and `address` change to ASCII before the code is made, so address data from a Japanese system goes in as it is. A postcode that is not 7 digits, or kanji in `address`, shows a help line, not bars. `onError` gets the error.
- The bar count is always 67, and the check bar goes in for you.
- The bars have no text. The address block prints the postcode for people.

## Anatomy

```text
JapanPostBarcode
```

## API reference

### JapanPostBarcode

| 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 7-digit postcode, with or without the hyphen: "150-2345". |
| `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. |
| `address` | `string` | "" | The block, house, and room numbers of the address: "5-6-3". |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| JapanPostBarcode | `japan-post-barcode` |  |  |  |

## Usage

Pass the postcode and the numbers of the address.

```tsx title="letter-code.tsx"
import { JapanPostBarcode } from "@/components/pro/labels/japan-post-barcode";

export function LetterCode() {
  return <JapanPostBarcode value="150-0002" address="3-21-2-804" 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/japan-post-barcode
```

It adds 18 registry items: 17 files, 2226 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 "Japan Post barcode" by default. Pass `aria-label` to say what it is, for example "Japan Post barcode for 150-0002".

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