Skip to content

QR Code

Wrapper for qrcode.

⚡️ Prerequisites

  • Install the qrcode package:
$ pnpm add qrcode

---> 100%

🎬 Usage

<script>
    import {qr_code} from "svelteintegrations/qr_code"

    let value = 'world';

    $: ({output, pending, error} = qr_code(value))
</script>

<img src="{$output}" alt="qrcode" />

<br/>

<p>Pending: {$pending}</p>

<p>Error: {$error}</p>

<br/>

<input bind:value />

👩‍💻API

Arguments

Name Description Type Required
text The text to encode string Yes

Options

Read the qrcode documentation

Returns

Name Description Type
output The base64 encoded image Readable<string>
pending When the image is being generated Readable<boolean>
error When an error occurs Readable<string | unknown>

🧪 Playground


Last update: 2022-10-24