Componentticket-stub2.51 KB gzipZero dependencies

QR Code

Generates QR codes with Reed-Solomon error correction, mask evaluation, and finder patterns. Includes encodeQrMatrix helper.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add qr-code

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { QrCode, encodeQrMatrix } from "@/components/ui/qr-code"; <QrCode value="hello" />

Source code

qr-code.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxqr-code.tsx357 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; /** * GF(256) exp/log lookup tables for QR Reed-Solomon error correction (poly 0x11d, alpha = 2). */const { GF_EXP, GF_LOG } = (() => {  const exp = new Uint8Array(512);  const log = new Uint8Array(256);  let x = 1;  for (let i = 0; i < 255; i++) {    exp[i] = x;    exp[i + 255] = x;    log[x] = i;    x <<= 1;    if (x & 0x100) x ^= 0x11d;

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { encodeQrMatrix } from "@/components/ui/qr-code"; <encodeQrMatrix />
PropTypeDescription
valuestringThe data to encode in the QR code.
sizenumberPixel size of the QR code (default: 200).
levelQrLevelError correction level (default: M).
scanbooleanShow scanning laser line effect.