No Preview

Sorry, but you either have no stories or none are selected somehow.

If the problem persists, check the browser console, or the terminal you've run Storybook from.

deckgo-qrcode

The "QR Code" component is an extra component which let you add QR code in your slides, useful for example to display links and url and if you wish your audience to easily access them.

To generate the QR code, the project qrcode-generator from Kazuhiko Arase is used.

Installation

This component can be added to your web application with following methods.

If you are using our Starter Kit, no need to worry about this, this component is included, therefore you could skip the "Installation" chapter.

Using from a CDN

It's recommended to use unpkg to use the [DeckDeckGo] lazy image component from a CDN. To do so, add the following include script in the main HTML file of your project:

<script type="module" src="https://unpkg.com/@deckdeckgo/elements@latest/dist/elements/elements.esm.js"></script>

Install from NPM

Install it in your project from npm using the following command:

npm install @deckdeckgo/elements

Framework integration

The Stencil documentation provide examples of framework integration for Angular, React, Vue and Ember.

That being said, commonly, you might either import or load it:

Import

import '@deckdeckgo/elements';

Loader

import { defineCustomElements } from '@deckdeckgo/elements/dist/loader';
defineCustomElements();

Usage

The <deckgo-qrcode/> Web Component will generate per default a <svg/> QR code with a correction level set to high.

Optionally, it's also possible to generate the QR code as an <img/> and/or to display a logo over it.

It's possible to display a logo over your QR Code as the code generated with this Web Component have a correction level set to high meaning, if I understand correctly, that your content is encoded and displayed multiple times inside the QR code. Therefore, even if the logo cover a part of it, it will be still possible for a reader to read the content from "somewhere else" in the code.

However, test it carefully and play with the colours, cell-size and size of your code to ensure its readability.

Properties

PropertyAttributeDescriptionTypeDefault
contentcontentThe content, a text or an url, of the QR code to generatestringundefined
qrAltqr-altAn alternate text for the image of the QR codestringundefined
qrBackgroundColorqr-background-colorThe background color of the QR code. The value should be provided in a RGB-hex format. For example: FF0000stringundefined
qrCellSizeqr-cell-sizeThe size of the cell, useful to generate a bigger QR code, specially in case of . Use it wisely, I suggest a value between 0 and 20 for examplenumberundefined
qrFillColorqr-fill-colorThe color use to fill the QR code. The value should be provided in a RGB-hex format. For example: FF0000stringundefined
qrMarginqr-marginThe size of the code margin, in case you would like more spacingnumberundefined
typetypeThe type of QR code to generate, or stringDeckdeckgoQRCodeType.SVG

Methods

generate() => Promise<void>

The <deckgo-qrcode/> component exposes the following method in case you would like to refresh your QR code, for example on resize of the window on in case you would set its content asynchronously.

Returns

Type: Promise<void>

Slots

SlotDescription
"logo"An optional logo or image to be displayed over the QR code

CSS Custom Properties

NameDescription
--deckgo-qrcode-background-fillThe QR code's background @default transparent
--deckgo-qrcode-border-strokeThe border color of the QR code
--deckgo-qrcode-color-fillThe QR code's color (the color of the QR code's squares it contains)
--deckgo-qrcode-container-displayThe display property of the shadow host and the code container @default inline-block
--deckgo-qrcode-logo-ratio-sizeIf you are injecting a logo, its size, width and height, will be calculated with --deckgo-qrcode-size (or 100% if not provided) divided by this value @default 3
--deckgo-qrcode-sizeThe size, width and height, of the QR code

Built with StencilJS