Skip to content

GS1 Data Matrix Code

Pro

A small square code on a medicine pack or a medical device. It holds the product number, lot, expiry date, and serial, and checks each one.

  • React 19
  • Tailwind CSS 4

Added Nov 11, 2026 · Pro license

Playground

Loading the preview

Props

Needs your Pro API key in GELATIN_UI_PRO_TOKEN. Set it up

Pro itemAPI key required

GS1 Data Matrix Code needs a Pro API key

Try the live preview for free. With Pro, the add command above puts the source in your project.

Files it adds
14
More Pro items, one API key
+327
Your coding agent runs it
1 cmd

$79$129once, for life

Already have Pro? Sign in to set up your API key.

Pass the GS1 element string of the pack.

pack-code.tsx

Gs1DataMatrixCode

<div>
PropTypeDefaultDescription
aria-labelstring—Defines a string value that labels the current element. The accessible name. Default the kind ("Data Matrix code"), or "<kind>: <value>" for a link.
valueRequiredstring—The data etiket encodes. GS1 element strings: "(01)" and the GTIN-14, then "(17)" expiry, "(10)" lot, "(21)" serial.
pixelSizenumber—The outer width in px, quiet zone included. The height follows the symbol.
fitboolean—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.
plateboolean—The light plate under the code. Default true.
status"empty""error""loading""ready"—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.
labelsPartial<CodeSymbolLabels>—The texts of the empty and error states.
onError—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.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.
  • Pass the element string with each AI in brackets: "(01)09506000134352(17)270430(10)LOT42".
  • Put the fixed-length fields, (01) and the dates, before the lot (10) and the serial (21).
  • Use onError to stop a pack whose GTIN or date is wrong.
  • For an ID that is not GS1 data, use a Data Matrix Code.
  • For a link that any phone camera opens, use a QR Code.
  • For a 1D code on a case or a pallet, use a Barcode.

It is an image named "GS1 Data Matrix code" by default. Pass aria-label to say which product it is.

Show the GTIN, lot, expiry, and serial as text next to the code too.

  1. AddedGS1 Data Matrix Code.
Open the release