Angular UI Components Documentation
The Angular QRcode generates QR codes, with error-correction levels, colours and an embedded logo. This guide adds the Angular QRcode (jqxQRcode) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-ngjqwidgets-ng/jqxqrcode 
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 jqxQRcodeModule to the imports of the component that uses it.
import { Component } from '@angular/core';
import { jqxQRcodeModule } from 'jqwidgets-ng/jqxqrcode';
@Component({
selector: 'app-root',
imports: [jqxQRcodeModule],
templateUrl: './app.html'
})
export class App {}
The source of the live Default Functionality demo.
<div>
<section>
<div>
<h2>A QR Code is a type of two-dimensional barcode that representing data in a visual, machine-readable
form.</h2>
<div class="module">
<p>
QR codes are ideal components for programmatically encoding data.
They are often cused to ontain data for a locator, identifier, or tracker that points to a
website or application.
</p>
</div>
</div>
</section>
<section>
<h2>QR Code rendering modes</h2>
<div class="module">
<p>
QR Codes can be rendered as an <svg> and <canvas> element.<br />
Using the <b>svg</b> rendering mode is recommended as the QR Code doesn't lose quality when it is
zoomed.
</p>
</div>
<div class="module qrcode-container">
<jqxQRcode [renderAs]="'svg'" [value]="'SVG RENDER'"></jqxQRcode>
<jqxQRcode [renderAs]="'canvas'" [value]="'CANVAS REN'"></jqxQRcode>
</div>
</section>
<section>
<h2>QR Code Encoding Modes</h2>
<div class="module">
<p>
The qrcode element supports the following encoding modes:</p>
<ul>
<li>
<b>Numeric</b>
</li>
<li>
<b>Alphanumeric</b>
</li>
<li>
<b>Byte / Binary</b>
</li>
<li>
<b>Kanji</b>
</li>
</ul>
</div>
<div class="module qrcode-container">
<jqxQRcode class="qrcode" [value]="'こんにちは世界'" [displayLabel]="true" [labelPosition]="'top'" [labelFontSize]="20">
</jqxQRcode>
<jqxQRcode class="qrcode" [value]="'HELLO WORLD'" [displayLabel]="true" [labelPosition]="'top'" [labelFontSize]="20">
</jqxQRcode>
</div>
</section>
<section>
<h2>QR Code Error Correction Levels</h2>
<div class="module">
<p>
The QR Code component supports all four error correction levels: <b>L</b>, <b>M</b>, <b>Q</b>, and
<b>H</b>.<br>
The higher the Error Correction Level, the higher is the amount of data that can be retrieved if
part of the QR Code is damaged or hidden.
</p>
</div>
<div class="module qrcode-container">
<div>
<h4><b>L</b> level encoding of <b>"Hello world"</b></h4>
<jqxQRcode class="qrcode" [value]="'Hello world'" [errorLevel]="'L'"></jqxQRcode>
</div>
<div>
<h4><b>H</b> level encoding of <b>"Hello world"</b></h4>
<jqxQRcode class="qrcode" [value]="'Hello world'" [errorLevel]="'H'"></jqxQRcode>
</div>
</div>
</section>
<section>
<h2>QR Code Embed Image</h2>
<div class="module">
<p>
When the Error Correction Level is sufficiently high, it is possible to embed an Image inside the QR
Code.<br>
The maximum size of the image depends on the Error Correction Level and the QR Code value.
</p>
</div>
<div class="module qrcode-container">
<jqxQRcode class="qrcode" [value]="'GITHUB.COM'"
[embedImage]="'https://cdn3.iconfinder.com/data/icons/inficons/512/github.png'" [imageWidth]="40"
[imageHeight]="40"></jqxQRcode>
<jqxQRcode class="qrcode" [value]="'ANGULAR.IO'"
[embedImage]="'https://angular.io/assets/images/logos/angular/angular.svg'" [imageWidth]="60"
[imageHeight]="60"></jqxQRcode>
</div>
</section>
<section>
<h2>Appearance</h2>
<div class="module">
<p>The QR Code's color, background color and square dimensions can be customized by their respective
properties.</p>
<p>The label of the QR Code 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 qrcode-container">
<jqxQRcode class="qrcode" [value]="'HTMLELEMENTS.COM'" [labelPosition]="'top'" [labelFontSize]="15"
label-color="orange" [labelFont]="'arial'" line-color="orange" [displayLabel]="true"></jqxQRcode>
<jqxQRcode class="qrcode" [value]="'JQWIDGETS.COM'" [labelPosition]="'top'" [labelFontSize]="20" [labelColor]="'red'"
[labelFont]="'helvetica'" [lineColor]="'darkblue'" [displayLabel]="true"></jqxQRcode>
</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>Rock Concert</h3>
<img height="170" alt="Rock Concert"
src="https://upload.wikimedia.org/wikipedia/commons/0/05/Interior_del_estadio_Ruca_Che.JPG" />
<h4>For more information:</h4>
</div>
<div class="card-footer">
<jqxQRcode class="qrcode" [value]="'Rock Concert'" [squareWidth]="6"></jqxQRcode>
</div>
</div>
<div class="card-container">
<div class="card-body">
<h3>7-day Spa Vacation</h3>
<img height="170" alt="Spa massage"
src="https://upload.wikimedia.org/wikipedia/commons/6/6e/Taj_Spa_4.jpg" />
<h4>For more information:</h4>
</div>
<div class="card-footer">
<jqxQRcode class="qrcode" [value]="'Spa Vacation'" [squareWidth]="6"></jqxQRcode>
</div>
</div>
<div class="card-container">
<div class="card-body">
<h3>10-day Skiing Holiday</h3>
<img height="170" alt="Skiing village"
src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/60/Ruka_Village_%288361909910%29.jpg/1280px-Ruka_Village_%288361909910%29.jpg" />
<h4>For more information:</h4>
</div>
<div class="card-footer">
<jqxQRcode class="qrcode" [value]="'Skiing Holiday'" [squareWidth]="6"></jqxQRcode>
</div>
</div>
</div>
</section>
</div>import { Component, ViewEncapsulation, AfterViewInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import { jqxQRcodeModule } from 'jqwidgets-ng/jqxqrcode';
@Component({
imports: [CommonModule, jqxQRcodeModule],
selector: 'app-root',
templateUrl: './app.html',
encapsulation: ViewEncapsulation.None,
// A page margin, a sans-serif font, and space between the QR codes shown side by side.
styles: [
`
app-root {
display: block;
padding: 0 16px 16px;
font-family: Roboto, 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.qrcode-container,
#barcode-demo-container {
display: flex;
flex-wrap: wrap;
gap: 20px;
align-items: flex-start;
}
`
]
})
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 QR Code is invalid.
<jqxQRcode (onInvalid)="onInvalid($event)"></jqxQRcode>
onInvalid(event: any): void {
console.log(event.args);
}
Get the component with a signal query and call its methods. For example, export: Exports the QR Code.
<jqxQRcode #myQRcode></jqxQRcode>
import { Component, viewChild } from '@angular/core';
import { jqxQRcodeModule, jqxQRcodeComponent } from 'jqwidgets-ng/jqxqrcode';
@Component({
selector: 'app-root',
imports: [jqxQRcodeModule],
templateUrl: './app.html'
})
export class App {
readonly myQRcode = viewChild.required<jqxQRcodeComponent>('myQRcode');
run(): void {
this.myQRcode().export('format');
}
}