Skip to content

QR Code

Renders a QR code as SVG for any value.

html
<div
  data-controller="zag-qr-code"
  data-part="root"
  data-zag-qr-code-value-value="https://github.com/mateomurphy/stimulus-zag"
  class="border-border bg-popover h-32 w-32 rounded-lg border p-2"
>
  <svg data-part="frame" class="h-full w-full">
    <path data-part="pattern" fill="currentColor"></path>
  </svg>
</div>

Parts

root, frame, pattern, overlay, download-trigger.

Values

AttributeTypeDefaultDescription
data-zag-qr-code-value-valueString""The value to encode.
data-zag-qr-code-pixel-size-valueNumber10Size of each QR module.

Events

Emits zag-qr-code:changedetail is { value }.

Programmatic control

value (getter), setValue(value).