Angular UI Components Documentation
The Angular Barcode generates barcodes in common 1D symbologies, rendered as SVG or Canvas. This guide adds the Angular Barcode (jqxBarcode) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-ngjqwidgets-ng/jqxbarcode 
In an Angular project (to start one, see Getting started with Angular), add the package with the Angular CLI. It asks for a theme and adds the styles to angular.json:
ng add jqwidgets-ng
Components are standalone: add jqxBarcodeModule to the imports of the component that uses it.
import { Component } from '@angular/core';
import { jqxBarcodeModule } from 'jqwidgets-ng/jqxbarcode';
@Component({
selector: 'app-root',
imports: [jqxBarcodeModule],
templateUrl: './app.html'
})
export class App {}
The source of the live Default Functionality demo.
<div class="jqx-demo-container">
<div>
<section>
<div>
<h2>A barcode is a method of representing data in a visual, machine-readable form.</h2>
<div class="module">
<p>
Barcodes are ideal components for programmatically encoding data.
They are commonly used for storing data such as item serial numbers in retailers and
warehouses.
</p>
</div>
</div>
</section>
<section>
<h2>Barcode rendering modes</h2>
<div class="module">
<p>
Barcodes can be rendered as an <svg> and <canvas> element.<br />
Using the <b>svg</b> rendering mode is recommended as the barcode doesn't lose quality when it
is zoomed.
</p>
</div>
<div class="module">
<jqxBarcode class="barcode" id="barcode1" [renderAs]="'svg'" [type]="'code128a'" [value]="'SVG RENDER'"></jqxBarcode>
<jqxBarcode class="barcode" id="barcode2" [renderAs]="'canvas'" [type]="'code128a'" [value]="'CANVAS REN'"></jqxBarcode>
</div>
</section>
<section>
<h2>Barcode Types</h2>
<div class="module">
<p>
The barcode element supports a wide range of the most common barcode types available:</p>
<ul>
<li><b>PharmaCode</b></li>
<li><b>CodaBar</b></li>
<li><b>Code128A | Code128B | Code128C</b></li>
<li><b>MSI | MSI10 | MSI11 | MSI1010 | MSI1110</b></li>
<li><b>EAN8 | EAN13</b></li>
<li><b>Code39</b></li>
<li><b>Code93</b></li>
</ul>
</div>
<div>
<jqxBarcode class="barcode" id="barcode3" [type]="'pharmacode'" [value]="'12345'"></jqxBarcode>
<jqxBarcode class="barcode" id="barcode4" [type]="'code128c'" [value]="'22481203'"></jqxBarcode>
<jqxBarcode class="barcode" id="barcode5" [type]="'codabar'" [value]="'A2402B'"></jqxBarcode>
<jqxBarcode class="barcode" id="barcode6" [type]="'code39'" [value]="'*1234*'"></jqxBarcode>
<jqxBarcode class="barcode" id="barcode7" [type]="'code128a'" [value]="'EXAMPLE'"></jqxBarcode>
</div>
</section>
<section>
<h2>Appearance</h2>
<div class="module">
<p>The barcode's color, background color and bar dimensions can be customized by their respective
properties.</p>
<p>The label of the barcode can be set to visible or hidden with <b>displayLabel</b>.
Its color, font, size, margins and position can be customized by their respective properties.
</p>
</div>
<div class="module ">
<jqxBarcode class="barcode" id="barcode8" [value]="'A2402B'" [labelPosition]="'top'" [labelFontSize]="30"
[labelColor]="'orange'" [labelFont]="'arial'" [lineColor]="'orange'"></jqxBarcode>
</div>
</section>
<section>
<h2>Demo</h2>
<div class="module">
</div>
<div id="barcode-demo-container" class="module">
<div class="card-container">
<div class="card-body">
<h3>Dinner Table</h3>
<img height="150" alt="Dinner table"
src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4f/Kitchen_table.jpg/1280px-Kitchen_table.jpg">
<br />
<button class="success purchase-button">Purchase Now</button> <br />
</div>
<div class="card-footer">
<jqxBarcode class="barcode" id="barcode9" [value]="'23849'" [type]="'code128c'" [labelFont]="'arial'"></jqxBarcode>
</div>
</div>
<div class="card-container">
<div class="card-body">
<h3>Modern Wardrobe</h3>
<img height="150" alt="Modern Wardrobe"
src="https://upload.wikimedia.org/wikipedia/commons/d/d6/Sliding-wardrobe.jpg">
<br /> <button class="success purchase-button">Purchase Now</button> <br />
</div>
<div class="card-footer">
<jqxBarcode class="barcode" id="barcode10" [value]="'86941'" [type]="'code128c'" [labelFont]="'arial'"></jqxBarcode>
</div>
</div>
<div class="card-container">
<div class="card-body">
<h3>Office Chair</h3>
<img height="150" alt="Office Chair"
src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d4/Buerostuhl_%28fcm%29.jpg/960px-Buerostuhl_%28fcm%29.jpg">
<br /> <button class="success purchase-button">Purchase Now</button> <br />
</div>
<div class="card-footer">
<jqxBarcode class="barcode" id="barcode11" [value]="'03278'" [type]="'code128c'" [labelFont]="'arial'"></jqxBarcode>
</div>
</div>
</div>
</section>
</div>
</div>import { Component, ViewEncapsulation, AfterViewInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import { jqxBarcodeModule } from 'jqwidgets-ng/jqxbarcode';
@Component({
imports: [CommonModule, jqxBarcodeModule],
selector: 'app-root',
templateUrl: './app.html',
encapsulation: ViewEncapsulation.None,
styles: []
})
export class App implements AfterViewInit {
ngAfterViewInit(): void {}
}
Options are inputs, bound with [name]="value".
Events are outputs named on plus the event name with a capital first letter. For example, invalid: This event is triggered when the value of the qrcode is invalid.
<jqxBarcode (onInvalid)="onInvalid($event)"></jqxBarcode>
onInvalid(event: any): void {
console.log(event.args);
}
Get the component with a signal query and call its methods. For example, export: Exports the qrcode.
<jqxBarcode #myBarcode></jqxBarcode>
import { Component, viewChild } from '@angular/core';
import { jqxBarcodeModule, jqxBarcodeComponent } from 'jqwidgets-ng/jqxbarcode';
@Component({
selector: 'app-root',
imports: [jqxBarcodeModule],
templateUrl: './app.html'
})
export class App {
readonly myBarcode = viewChild.required<jqxBarcodeComponent>('myBarcode');
run(): void {
this.myBarcode().export('format');
}
}