Reference
QrCode
A QR code for a URL or any text, drawn as vector graphics when the page is built.
QrCode(_ value: String, color: String, background: String)
Since 5.2.0
Ticket QX-4821
Show this at the door.
Example
Card.outlined {
Row(gap: .md, align: .center) {
QrCode("https://example.com/tickets/QX-4821")
Stack(gap: .xs) {
Text("Ticket QX-4821").bold
Text("Show this at the door.").muted
}
}
}
In your colours
QrCode("https://example.com/menu", color: "#1E3A8A", background: "#F8FAFC")
Props
| Prop | Type | Unset | Meaning |
|---|---|---|---|
value | String (positional) | — | What it encodes, a URL or any text, known when the page is built ( |
color: | String |
| The colour of the dark modules, a CSS colour; anything else is the default |
background: | String |
| The colour behind them, a CSS colour; anything else is the default |
Attribute families: global, aria, data. Plus the 22 universal props every element takes: animate:, exit:, speed:, duration:, delay:, easing:, stagger:, on:, count:, shared:, class:, ref:, drag:, dragGroup:, dropValue:, dropAxis:, dropInside:, roving:, trapFocus:, mount:, update:, cleanup:.
Flags and cases
A flag is written after the parentheses with a dot: a Bool prop, or a case of one of the element's enum props. A case the enum lacks is an error with a hint.
No flags of its own.
Events
Every element also takes the props, the events and the attribute families listed on every element.
Slots
It takes no slots.
Renders with the class wf-qr, stable across releases, so a stylesheet may target it.
Codes this can raise
These controls list the props' cases; the example below shows them written.