@sveltevk/qr v1.0.0
Svelte VK-QR
Svelte components for VK-style QR codes.
Setup
npm i @sveltevk/qr
Usage
Base QR Code
<script>
import { Qr } from '@sveltevk/qr';
</script>
<Qr text="Text to encode" qrSize={256} isShowLogo />
text
required String to generate a QR code
Wi-Fi Network config
<script>
import { QrWiFi } from '@sveltevk/qr';
</script>
<QrWiFi ssid="SSID" password="password" authType="WPA" />
ssid
: Network SSID. Required. Enclose in double quotes if it is an ASCII name, but could be interpreted as hex (i.e."ABCD"
)authType
: Authentication type. Can beWEP
orWPA
orWPA2-EAP
, ornopass
for no password. Or, omit for no passwordpassword
: Password, ignored ifauthType="nopass"
(in which case it may be omitted). Enclose in double quotes if it is an ASCII name, but could be interpreted as hex (i.e."ABCD"
)hide
: Optional. True if the network SSID is hidden. Note this was mistakenly also used to specify phase 2 method in releases up to 4.7.8 / Barcode Scanner 3.4.0. If not a boolean, it will be interpreted as phase 2 method (see below) for backwards-compatibilityeap
: (WPA2-EAP only) EAP method, likeTTLS
orPWD
anonIdentity
: (WPA2-EAP only) Anonymous identityidentity
: (WPA2-EAP only) Identityphase2
: (WPA2-EAP only) Phase 2 method, likeMSCHAPV2
Options
An options object containing any custom settings that you want to apply to the generated QR code. The possible options are:
qrSize
: Size of QR code. Default is 128className
orclass
: Class name of root SVG elementisShowLogo
: Show VK logo in center of QR code Default is falseisShowBackground
: Show QR background. Default is falsebackgroundColor
: QR code background HEX color. Works ifisShowBackground
is enabled. Default is "#ffffff"foregroundColor
: QR code HEX colorlogoColor
: Color of logo. Default is "#4680c2"logoData
: Reference to logo as a reference IRIsuffix
: SVG elements id postfixecc
: ECC level in range 0-3 (0 - low, 3 - high)