QR Code

PreviousNext

A customizable QR code component with styling options for Delta applications.

Installation

pnpm dlx shadcn@latest add https://deltacomponents.dev/r/qrcode.json

Usage

import QRCode from "@/components/ui/qrcode"
 
export default function Example() {
  return <QRCode value="https://example.com" size={200} />
}

Examples

Purple Dots Style

Add a logo to the center of your QR code using the logoImage prop:

<QRCode
  value="https://example.com"
  logoImage="https://example.com/logo.png"
  logoSize={0.25}
  logoMargin={4}
  level="H"
  size={200}
/>

Clickable Navigation

When enableNavigation is set to true, the QR code becomes clickable and will open the encoded URL in a new tab:

<QRCode value="https://example.com" enableNavigation={true} size={200} />

API Reference

Props

PropTypeDefaultDescription
valuestring-The data to encode in the QR code (required)
sizenumber200Width and height of the QR code in pixels
bgColorstring"--color-background"Background color (CSS variable or color value)
fgColorstring"--color-foreground"Foreground color (CSS variable or color value)
level"L" | "M" | "Q" | "H""M"Error correction level
marginSizenumber0Margin size around the QR code
classNamestring-Additional CSS classes
enableNavigationbooleanfalseEnable click navigation to open the QR code URL in a new tab
dotStyle"rounded" | "dots" | "classy" | "classy-rounded" | "square" | "extra-rounded""square"Style of the QR code dots
cornerSquareStyle"dot" | "square" | "extra-rounded" | "rounded" | "dots" | "classy" | "classy-rounded""square"Style of the corner squares
cornerDotStyle"dot" | "square" | "rounded" | "dots" | "classy" | "classy-rounded" | "extra-rounded""square"Style of the corner dots
logoImagestring-URL or data URI for the logo image to display in the center
logoSizenumber0.2Size of the logo as a percentage of the QR code size (0-1)
logoMarginnumber0Margin around the logo in pixels