Docs
QR Code
QR Code

A flexible QR code generator with theme integration, custom styling, error handling, and loading states built with the qrcode library.

Overview

The QR Code component bridges physical and digital experiences by generating scannable codes that connect users to websites, contact information, or any digital content. It features automatic theme integration and error handling, making it essential for marketing materials, business cards, and any application requiring quick digital access. Perfect for improving user onboarding and reducing friction in offline-to-online conversion funnels.

Installation

pnpm dlx shadcn@latest add https://deltacomponents.dev/r/qr-code.json

Usage

import QRCode from "@/registry/media/qr-code"
 
export function Component() {
  return (
    <QRCode
      value="https://deltacomponents.dev"
      size={200}
      bgColor="--color-card"
      fgColor="--color-card-foreground"
    />
  )
}

API Reference

Props

PropTypeDefaultDescription
valuestring-The data to encode in the QR code (required)
sizenumber200Size of the QR code in pixels
bgColorstring"--color-card"Background color (CSS variable or color value)
fgColorstring"--color-card-foreground"Foreground color (CSS variable or color value)
errorCorrectionLevel"L" | "M" | "Q" | "H""M"Error correction level
marginnumber4Margin around the QR code
classNamestring""Additional CSS classes for the canvas
containerClassNamestring""Additional CSS classes for the container

Examples

Custom Styling

QR codes with custom colors and enhanced visual styling.

Primary Theme

Destructive Theme

Muted Theme

Custom Border

Reactive QR Code

Interactive QR code generation with real-time input and preview.

Reactive Dark Mode QR Code

This QR code automatically adapts to light and dark themes

Uses --color-background and --color-foreground for automatic theme adaptation