Skip to main content
Once you’ve installed the package, you can generate a QR code in a single line. Choose the approach that best fits where you need it: a controller, a Blade template, or a terminal session.
The <x-qr-code> component is the simplest way to embed a QR code in a template. It handles SVG injection and accessibility attributes automatically.
{{-- Minimal usage — renders a 100px SVG --}}
<x-qr-code data="https://example.com" />
Common options:
<x-qr-code
    data="https://example.com"
    size="300"
    format="svg"
    color="#1a56db"
    background-color="#ffffff"
    margin="2"
/>
Generate a PNG embedded as a base64 data URI:
<x-qr-code
    data="https://example.com"
    format="png"
    size="400"
/>
When format is svg, the component injects the SVG inline (including an accessible <title> and role="img"). When format is png or webp, it renders an <img> tag with a base64 src attribute — no file needs to be written to disk.
Pass extra HTML attributes directly:Any attributes not recognized as component props are forwarded to the rendered element:
<x-qr-code
    data="https://example.com"
    size="200"
    class="rounded shadow"
    id="product-qr"
/>
Both <x-qr-code> and <x-qrcode> (no hyphen) are registered. Use whichever naming convention matches your project style.

Next steps

Blade Component

See every prop the <x-qr-code> component accepts, including gradient and eye-style customization.

Facade Reference

Explore the full QrCode facade API — colors, gradients, styles, image merging, and all fluent methods.

Data Types

Generate QR codes for WiFi, vCard, SMS, Email, WhatsApp, Telegram, BTC, Ethereum, and more.