Rebar UI

1.0

imitation

Barcode

A scannable Code 128 barcode as SVG, with the value shown underneath.

Invoice referenceCode 128, value printed below
INV-1042
No text
Short
A1
Long value
HARBOUR-REBRAND-24-OCT-0001

In context

Invoice slipThe barcode on a printable supplier invoice
Invoice INV-1042

Northern Print Co.

Due

Depot signage, 23 Oct. Total £3,860.50.

INV-1042

Props

PropTypeRequiredDefault
valuestringYes—
barWidthnumber | undefinedNo2
heightnumber | undefinedNo60
colorstring | undefinedNo#000000
bgColorstring | undefinedNo#ffffff
showTextboolean | undefinedNotrue
quietZonenumber | undefinedNo10

Width

A real Code 128 barcode. barWidth sets the narrowest bar in px and the total width scales with the value, as a scanner needs; quietZone adds the blank margin around it.

data-rebar-* attributes

data-rebar-component="barcode" on the root <svg>; each bar is data-rebar-part="bar", the text (with showText) is data-rebar-part="text".

Migrating to Ant Design

AntD ships no barcode component; use jsbarcode or react-barcode, or keep this encoder and swap the shell.