---
title: "GS1 DataBar Barcode"
description: "A short barcode for a produce sticker or a fresh food pack. The expanded kind also holds the weight, the price, and the use-by date."
url: https://gelatinui.com/components/gs1-data-bar-barcode
markdown_url: https://gelatinui.com/components/gs1-data-bar-barcode.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/gs1-data-bar-barcode"
version: "2026-11-11"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# GS1 DataBar Barcode

> A short barcode for a produce sticker or a fresh food pack. The expanded kind also holds the weight, the price, and the use-by date.

Page: https://gelatinui.com/components/gs1-data-bar-barcode

## When to use it

Best for: A product number on a small item, or a fresh food pack whose code holds the weight, price, and date.

- Use `omni` (default) for a till that scans at any angle, and `limited` for small items.
- Use `expanded` with GS1 AIs for weight (3103), price (3922), and dates (15, 17).
- Use `textPosition="none"` on a small sticker, and print the text in your own place.

## When not to use it

- For a standard retail pack (EAN-13 or UPC-A), use a [Barcode](https://gelatinui.com/components/barcode.md).
- For the price on the label, add a [Price](https://gelatinui.com/components/price.md).

## Notes for agents

- `fit` fills the width of the parent, in whole px a module when that loses one module or less.
- `omni` and `limited` take 13 digits (the check digit is added) or 14. `limited` takes only a GTIN that starts with 0 or 1.
- `expanded` takes a GS1 element string with each AI in brackets.
- The text under the bars can be wider than a short code: on a small code, set `textPosition="none"` and print the text yourself.
- A wrong check digit or a letter shows a help line, not bars. `onError` gets the error.

## Anatomy

```text
Gs1DataBarBarcode
```

## API reference

### Gs1DataBarBarcode

| 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. `omni` and `limited`: the GTIN, 13 digits (the check digit is added) or 14. `expanded`: a GS1 element string with more data, "(01)09506000134352(3103)000195" (net weight 0.195 kg). |
| `variant` | `"expanded" \| "limited" \| "omni"` | "omni" | `omni` (default): omnidirectional, scans at any angle at a till. `limited`: smaller, for small items, GTINs that start with 0 or 1. `expanded`: adds weight, price, and dates for fresh food. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| Gs1DataBarBarcode | `gs1-data-bar-barcode` |  |  |  |

## Usage

Pass the GTIN, and pick the variant.

```tsx title="produce-code.tsx"
import { Gs1DataBarBarcode } from "@/components/pro/labels/gs1-data-bar-barcode";

export function ProduceCode() {
  return <Gs1DataBarBarcode value="0950600013435" variant="limited" height={24} />;
}
```

## 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-data-bar-barcode
```

It adds 17 registry items: 16 files, 2370 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)
- [Price](https://gelatinui.com/components/price.md)
- [Till Receipt](https://gelatinui.com/components/till-receipt.md)

## Accessibility

It is an image, named by its GS1 text by default ("GS1 DataBar: (01)09506000134352"). Pass `aria-label` to say what it is.

The GS1 text also shows under the bars, unless `textPosition="none"`.
