Skip to content
MultimediaInteractive playground

Barcode

Barcodes and QR codes in one component.

Preparing the playground…
Text and Markdown example
Barcode · Example
1<Barcode value="KIVORA-2026" format="code128" width={280} displayValue />
Read documentation in Markdown

How to use it

format defines the encoding. EAN and UPC require valid values and check digits. onError and fallback handle invalid input.

Import

React / Next.js
1import { Barcode } from "@kivora/nextjs";

Interactive examples run inside a component with "use client". The playground's Copy button includes the imports needed for the current example.

API reference 0.2.0

Types from the installed published version, including component properties and common HTML attributes. “Optional” does not imply a default value; omitting a property lets the component decide.

PropertyTypeDescription
valueRequiredstringControlled value. Update it from the change callback.
aria-labelstringAccessible name of the control.
backgroundstringOpaque #RRGGBB background color.
classNamestringAdditional CSS classes to customize the element.
defaultCheckedbooleanInitial selection of the control.
defaultValuestring | number | readonly string[]Initial value when the component manages its own state.
displayValuebooleanShow the code's readable value.
errorCorrectionLevel"L" | "M" | "Q" | "H"QR error correction level.
fallbackReactNodeAlternative content when the main content cannot be displayed.
foregroundstringOpaque #RRGGBB color for modules.
format"qrcode" | "code128" | "code39" | "ean13" | "ean8" | "upca" | "interleaved2of5" | "datamatrix" | "pdf417" | "azteccode"Barcode format.
heightnumberOutput height.
idstringElement identifier; associates labels and descriptions.
marginnumberCode margin. Keep a sufficient quiet zone.
onChangeChangeEventHandler<HTMLDivElement, Element>Change event. Check the type: some controls return an object, others a DOM event.
onClickMouseEventHandler<HTMLDivElement>Action performed when the element is activated.
onError((error: Error) => void)Receives errors for the application to handle.
onSubmitSubmitEventHandler<HTMLDivElement>Form submission event.
roleAriaRoleSemantic role of the element. Keep the default role unless a change is justified.
styleCSSPropertiesReact inline styles.
tabIndexnumberKeyboard focus order and availability.
titlestringTitle or supplementary information.
widthnumberOutput width.

TypeScript definition

Review each component's properties and published declaration. Native and accessibility attributes are inherited from the element specified by its type.

Barcode23 properties
Barcode · TypeScript
1Barcode: React.ForwardRefExoticComponent<BarcodeProps & React.RefAttributes<HTMLDivElement>>
API generated from @kivora/nextjs 0.2.0View package