BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/delta-components/qrcode

qrcode

delta-components/qrcode
FreeComponent

delta-components publishes no description for this item.

Live preview

live · rendered by the registry
Rendered by delta-components on their own page — this is the component running, not a screenshot of it.

Install it

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

Source

components/ui/qrcode.tsxdeltacomponents.dev/r/qrcode.json · first 6 KB
1"use client"
2
3import React, { useEffect, useRef } from "react"
4import QRCodeStyling from "qr-code-styling"
5
6import { cn } from "@/lib/utils"
7
8interface QRCodeProps {
9 value: string
10 size?: number
11 bgColor?: string // Can be a CSS variable (e.g. --color-background) or a color value
12 fgColor?: string // Can be a CSS variable (e.g. --color-foreground) or a color value
13 level?: "L" | "M" | "Q" | "H"
14 marginSize?: number
15 className?: string
16 enableNavigation?: boolean // Enable click navigation to the QR code URL
17 dotStyle?:
18 | "rounded"
19 | "dots"
20 | "classy"
21 | "classy-rounded"
22 | "square"
23 | "extra-rounded"
24 cornerSquareStyle?:
25 | "dot"
26 | "square"
27 | "extra-rounded"
28 | "rounded"
29 | "dots"
30 | "classy"
31 | "classy-rounded"
32 cornerDotStyle?:
33 | "dot"
34 | "square"
35 | "rounded"
36 | "dots"
37 | "classy"
38 | "classy-rounded"
39 | "extra-rounded"
40 logoImage?: string // URL or data URI for the logo image
41 logoSize?: number // Size of the logo as a percentage of the QR code size (0-1)
42 logoMargin?: number // Margin around the logo in pixels
43}
44
45// Helper to resolve CSS variable or direct color
46function resolveColor(color?: string, fallback?: string) {
47 if (!color) return fallback
48 if (color.startsWith("--")) {
49 if (typeof window !== "undefined") {
50 const value = getComputedStyle(document.documentElement).getPropertyValue(
51 color
52 )
53 if (value) return value.trim()
54 }
55 return fallback
56 }
57 return color
58}
59
60export default function QRCode({
61 value,
62 size = 200,
63 // Use shadcn theme variables for best contrast by default
64 bgColor = "--color-background", // background
65 fgColor = "--color-foreground", // foreground (text/qr dots)
66 level = "M",
67 marginSize = 0,
68 className,
69 enableNavigation = false,
70 dotStyle = "square",
71 cornerSquareStyle = "square",
72 cornerDotStyle = "square",
73 logoImage,
74 logoSize = 0.2,
75 logoMargin = 0,
76}: QRCodeProps) {
77 const ref = useRef<HTMLDivElement>(null)
78 const qrCodeRef = useRef<QRCodeStyling | null>(null)
79
80 useEffect(() => {
81 if (!value || !ref.current) return
82
83 // Always resolve to actual color values
84 const resolvedBgColor = resolveColor(bgColor, "hsl(0, 0%, 100%)") // fallback: white
85 const resolvedFgColor = resolveColor(fgColor, "hsl(222.2, 84%, 4.9%)") // fallback: dark
86
87 const qrCode = new QRCodeStyling({
88 width: size,
89 height: size,
90 type: "svg",
91 data: value,
92 margin: marginSize,
93// … truncated

What it pulls in

npm packages

  • qr-code-styling

Files it writes

  • registry/delta-ui/delta/qrcode.tsx

Facts

Registry
delta-components
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-04
Last confirmed
today

Go to the source

Docs on delta-components deltacomponents.dev pprunty/deltacomponents.dev on GitHub Raw registry item This item as JSON

More from delta-components

All 93 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
admonitionadmonitiondelta-componentsComponentsFree1 dep
cambio-imagecambio-imagedelta-componentsComponentsFree2 deps
card-deckcard-deckdelta-componentsComponentsFree3 deps
chatchatdelta-componentsComponentsFree3 deps
code-blockcode-blockdelta-componentsComponentsFree3 deps
code-block-iconscode-block-iconsdelta-componentsComponentsFreeno deps
copy-buttoncopy-buttondelta-componentsComponentsFree1 dep
input-otpinput-otpdelta-componentsComponentsFree1 dep
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex