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 />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.
| Property | Type | Description |
|---|---|---|
valueRequired | string | Controlled value. Update it from the change callback. |
aria-label | string | Accessible name of the control. |
background | string | Opaque #RRGGBB background color. |
className | string | Additional CSS classes to customize the element. |
defaultChecked | boolean | Initial selection of the control. |
defaultValue | string | number | readonly string[] | Initial value when the component manages its own state. |
displayValue | boolean | Show the code's readable value. |
errorCorrectionLevel | "L" | "M" | "Q" | "H" | QR error correction level. |
fallback | ReactNode | Alternative content when the main content cannot be displayed. |
foreground | string | Opaque #RRGGBB color for modules. |
format | "qrcode" | "code128" | "code39" | "ean13" | "ean8" | "upca" | "interleaved2of5" | "datamatrix" | "pdf417" | "azteccode" | Barcode format. |
height | number | Output height. |
id | string | Element identifier; associates labels and descriptions. |
margin | number | Code margin. Keep a sufficient quiet zone. |
onChange | ChangeEventHandler<HTMLDivElement, Element> | Change event. Check the type: some controls return an object, others a DOM event. |
onClick | MouseEventHandler<HTMLDivElement> | Action performed when the element is activated. |
onError | ((error: Error) => void) | Receives errors for the application to handle. |
onSubmit | SubmitEventHandler<HTMLDivElement> | Form submission event. |
role | AriaRole | Semantic role of the element. Keep the default role unless a change is justified. |
style | CSSProperties | React inline styles. |
tabIndex | number | Keyboard focus order and availability. |
title | string | Title or supplementary information. |
width | number | Output 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