# new QrCode(config)
Its a Custom Web Component. Do not use the constructor directly with the new keyword. Instead, use one of the 3 following methods:
Create the Web Component and call its init method:
const myQrCode = document.createElement("a-qrcode").init(config)
Or use the shorthand for it:
const myQrCode = createQrCode({
text: "I'm a QRCode"
})
myQrCode.render()
Or directly declare the config inside a container component:
const myPanel = createPanel({
title: "My panel",
items: [
{
type: "qrcode",
text: "I'm a QRCode",
colorDark: "#00aaee",
correctionLevel: "H"
}
]
})
myPanel.render()
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
config |
object
|
||
text |
string
|
The text to encode as a QRCode |
|
width |
integer
|
<optional> |
Width in pixels |
height |
integer
|
<optional> |
Height in pixels |
colorDark |
string
|
<optional> |
Hexa color code. Default #000000 |
colorLight |
string
|
<optional> |
Hexa color code. Default #ffffff |
correctLevel |
string
|
<optional> |
"L", "M", "Q", or "H". Default "M" |
this
Generated markup
<a-qrcode class="a-qrcode">
<div class="qrcode-image"></div>
</a-qrcode>