---
title: "GS1-128 Barcode"
description: "A barcode for case and pallet labels that holds many facts at once: the product number, dates, lot, and weight, each with its code in brackets."
url: https://gelatinui.com/components/gs1-128-barcode
markdown_url: https://gelatinui.com/components/gs1-128-barcode.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/gs1-128-barcode"
version: "2026-11-11"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# GS1-128 Barcode

> A barcode for case and pallet labels that holds many facts at once: the product number, dates, lot, and weight, each with its code in brackets.

Page: https://gelatinui.com/components/gs1-128-barcode

## When to use it

Best for: Many facts in one code on a case or pallet: the product number, dates, lot, weight, and count.

- Write each Application Identifier in brackets: "(01)09506000134352(17)270430(10)LOT42".
- Use one module width for all codes on one label, as GS1 sets the label out.
- Use `unit="mm"` for print, and `plate={false}` on a white label.

## When not to use it

- For the SSCC alone, or a plain order number, use the Free [Barcode](https://gelatinui.com/components/barcode.md).
- For the facts in words next to the code, add a [Data List](https://gelatinui.com/components/data-list.md).

## Notes for agents

- FNC1 and the separators after fields of variable length go in for you.
- etiket checks the length and characters of each AI. It does not check the GTIN check digit or dates: check them before you pass the value.
- A wrong AI field shows a help line, not bars. `onError` gets the error.
- A long element string makes a wide code: use `moduleWidth={1}` or `fit` in a narrow column.

## Anatomy

```text
Gs1128Barcode
```

## API reference

### Gs1128Barcode

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `aria-label` | `string` |  | Defines a string value that labels the current element. The accessible name. Default "<kind>: <text>" ("EAN-13: 5901234123457"); Code 128 and Code 39 say the kind only, or the link, as their value can be a return code or a key. |
| `fit` | `boolean` |  | Fill the width of the parent, in whole px a module when that loses one module of width or less (as the QR Code), else the exact width. Default false: the narrowest bar sets the size (`moduleWidth`, `height`, `unit`). |
| `moduleWidth` | `number` |  | The narrowest bar in `unit`. Default 2 (px). Use whole px on screen. Values under 0.5px or 0.1mm (and 0, or not a number) clamp to them: the layout divides by this width. |
| `height` | `number` |  | The bar height in `unit`. Default 64 (px). With `fit`, the height in px. |
| `textPosition` | `"bottom" \| "none"` |  | The human-readable text under the bars. Default `bottom`. |
| `unit` | `"mm" \| "px"` |  | `mm` sizes the code for print: `moduleWidth={0.33}` is EAN-13 at 100%. Default `px`. |
| `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 (a wrong check digit, a letter in EAN-13), 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. |
| `value` | `string` |  | The data etiket encodes. The GS1 element string, each Application Identifier in brackets: "(01)09506000134352(17)270430 (10)LOT42". FNC1 and the group separators after fields of variable length go in for you; etiket checks the length and characters of each AI. Check the GTIN check digit and the dates yourself. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| Gs1128Barcode | `gs1-128-barcode` |  |  |  |

## Usage

Pass the GS1 element string with each AI in brackets.

```tsx title="case-code.tsx"
import { Gs1128Barcode } from "@/components/pro/labels/gs1-128-barcode";

export function CaseCode() {
  return <Gs1128Barcode value="(01)09506000134352(17)270430(10)LOT42" moduleWidth={1.5} />;
}
```

## 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/gs1-128-barcode
```

It adds 17 registry items: 16 files, 2338 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 by its element string by default. Pass `aria-label` to say what it is, for example "Case code, lot LOT42".

The element string also shows as text under the bars, unless `textPosition="none"`.
