Skip to content

QR Code

QRCode Image Generator

Usage

Simple Usage

https://persona.privyid.devpreview
vue
<template>
  <p-qrcode data="https://persona.privyid.dev" />
</template>

Sizing

Adjust QR size using prop size. Default is 200

Hello WorldHello WorldHello Worldpreview
vue
<template>
  <p-qrcode size="50" data="Hello World" />
  <p-qrcode size="100" data="Hello World" />
  <p-qrcode size="150" data="Hello World" />
</template>

Variant

There are 3 style variants: square, rounded and dots. Default value is square

Hello WorldHello WorldHello World
preview
vue
<template>
  <p-qrcode variant="square" data="Hello World" />
  <p-qrcode variant="rounded" data="Hello World" />
  <p-qrcode variant="dots" data="Hello World" />
</template>
https://persona.privyid.devhttps://persona.privyid.devpreview
vue
<template>
  <!-- From local assets -->
  <p-qrcode data="https://persona.privyid.dev" :logo="Logo" />
  <!-- From URL -->
  <p-qrcode data="https://persona.privyid.dev" logo="https://privy-open-source.github.io/design-system/assets/images/icon-privy.svg" />
</template>

<script lang="ts" setup>
import Logo from '../assets/logo.svg'
</script>

Color

https://persona.privyid.devpreview
vue
<template>
  <p-qrcode
    data="https://persona.privyid.dev"
    color="#0065D1" />
</template>

Background Color

https://persona.privyid.devpreview
vue
<template>
  <p-qrcode
    data="https://persona.privyid.dev"
    color="#3887DB"
    bg-color="#14181E" />
</template>

Binding v-model

You can binding the generated result with v-model.

Lorem ipsumpreview
vue
<template>
  <p-qrcode data="Lorem ipsum" v-model="result" />
</template>

<script lang="ts" setup>
const result = ref<File>()
</script>

result

Encode to base64

If you prefer base64-dataURI format, add modifier .base64 to your v-model.

Lorem ipsumpreview

result

vue
<template>
  <p-qrcode data="Lorem ipsum" v-model.base64="result" />
</template>

<script lang="ts" setup>
const result = ref('')
</script>

API

Props

PropsTypeDefaultDescription
dataAny-QRCode contains data
sizeNumber200QRCode image's width and height
variantStringsquareStyle variant.
valid value: square, rounded, dots
logoString-QRCode logo url
logoSizeNumber0.8QRCode logo size
logoMarginNumber8QRCode logo margin
colorString#000000QRCode color
bgColorString#FFFFFFQRCode background color
eccStringMQRCode error correction level.
valid value: L, M, H, Q
typeNumberNumber-QRCode type number
modeString-QRCode mode
optionsObject-Extends Qr Code Styling options
modelValueString-Result of generated image

Slots

NameDescription
There no slots here

Events

NameArgumentsDescription
There no props here

Released under the MIT License.