Lob QR code library for front-end applications
npm install @lob/qr-code-browserBrowser compatible version of the Lob QR Code library.
``typescript
import { createQRCodeCanvas } from '@lob/qr-code-browser';
const qrCodeCanvas: HTMLCanvasElement = await createQRCodeCanvas(
100, // width of the QR and canvas in pixels
'https://example.com/', // data to be encoded in the QR
{ // optional customization parameters
logo: logoFileOrUrl, // https://developer.mozilla.org/en-US/docs/Web/API/File or string URL
color: {
background: '#ffffff',
foreground: '#000000'
}
});
const container = document.querySelector('#container');
container.appendChild(qrCodeCanvas);
``