npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

glim-qr-code

v0.0.1

Published

Lightweight, beautiful, and customizable QR code generator for React & Next.js.

Downloads

177

Readme

npm version TypeScript License


🚀 Why glim-qr-code?

Built from the ground up for modern React and Next.js applications, glim-qr-code resolves the common headaches developers face with QR generation:

  • Zero Hydration Mismatch: Next.js App & Pages Router safe out of the box (uses "use client" transparently).
  • Beautiful Presets: Supports classic square, beautiful dots, and modern rounded styles.
  • Embedded Logos: Centered logos with padding/backgrounds are handled mathematically for you.
  • Export Ready: Seamlessly download as PNG, JPG, or copy raw SVG.
  • Micro Bundle: Extremely lightweight relying only on raw layout calculation, omitting massive canvas dependencies.

📦 Installation

npm install glim-qr-code

🛠️ Developer Architecture (How it works under the hood)

For our fellow developers, here is how the library is structured:

  1. useGlimQRCode (The Brains): A headless hook that converts your string payload into a deterministic 2D binary matrix [[1, 0, 1], ...]. It runs purely in JavaScript memory.
  2. GlimQRCode (The Muscles): A React UI Component that ingests the 2D matrix. Depending on your choice of renderAs="svg" (default and highly recommended for crispness) or renderAs="canvas", it mathematically plots each bit.
  3. QRCodeFormatters (The Translators): A pure utility object formatting strings specifically for smartphones (e.g., WIFI:S:MyNet...).

🎨 Usage & Examples

1. The Basic React / Next.js Setup

Just mount it and go.

import { GlimQRCode } from 'glim-qr-code';

export default function App() {
  return (
    <GlimQRCode 
      value="https://github.com/developer/glim-qr-code" 
      size={250}
      color="#1e293b" // Tailwind Slate 900
      bgColor="#f8fafc" // Tailwind Slate 50
    />
  );
}

2. Beautiful "Dots" Style with Custom Logo

If you want something that stands out—try type: "dots". If adding a logo, the library automatically bumps errorCorrectionLevel="H" so the QR remains scannable!

import { GlimQRCode } from 'glim-qr-code';

export function StyledBrandQR() {
  return (
    <GlimQRCode 
      value="https://mywebsite.com" 
      size={300}
      dotsOptions={{ type: 'dots', color: '#B45309' }}
      imageSettings={{
        src: '/assets/my-logo.png', // Any valid URL or public path
        width: 60,
        height: 60,
        bgColor: '#FFFFFF', // Creates a safe zone behind the logo
        margin: 4,
        borderRadius: 12
      }}
      caption="Scan to visit us!"
    />
  );
}

3. VCard, Wi-Fi, Email with formatters

We provide QRCodeFormatters so you never have to memorize obscure syntax again.

import { GlimQRCode, QRCodeFormatters } from 'glim-qr-code';

export function WiFiConnect() {
  // Generates WIFI:S:Starbucks;T:WPA;P:AwesomeCoffee123;;
  const wifiPayload = QRCodeFormatters.wifi('Starbucks', 'AwesomeCoffee123', 'WPA');

  return (
    <GlimQRCode 
      value={wifiPayload} 
      size={200}
      dotsOptions={{ type: 'rounded' }} 
    />
  );
}

4. Downloading the QR Code Programmatically

We expose a ref handle (GlimQRCodeRef) enabling you to trigger downloads natively.

import { useRef } from 'react';
import { GlimQRCode, GlimQRCodeRef } from 'glim-qr-code';

export function DownloadableInvoice() {
  const qrRef = useRef<GlimQRCodeRef>(null);

  const handleDownload = () => {
    // Supports "png", "jpeg", or "svg"
    qrRef.current?.download("png", "customer-invoice-qr");
  };

  return (
    <div style={{ textAlign: "center" }}>
      <GlimQRCode ref={qrRef} value="INV-2026-0599" size={250} />
      <button onClick={handleDownload} style={{ marginTop: "16px" }}>
        Download Receipt
      </button>
    </div>
  );
}

🎛️ API Reference

<GlimQRCode /> Properties

| Prop | Type | Default | Description | | ---- | ---- | ------- | ----------- | | value | string | Required | The exact payload to encode (URL, Text, JSON). | | size | number | 256 | Square width/height in pixels. | | color | string | '#000000' | Foreground color (the dots). | | bgColor | string | '#FFFFFF' | Background color. | | errorCorrectionLevel| 'L' \| 'M' \| 'Q' \| 'H' | 'M' | Scanning redundancy (L=7%, M=15%, Q=25%, H=30%). | | renderAs | 'svg' \| 'canvas' | 'svg' | Under-the-hood rendering engine. SVG scales infinitely. | | margin | number | 4 | The quiet zone block boundary. | | dotsOptions | { type, color } | { type: 'square' } | Types available: 'square', 'dots', 'rounded'. | | imageSettings | LogoOptions | undefined | Config object for dropping an image in the center. | | caption | string | undefined | Text displayed neatly below the code. | | alt | string | 'QR Code' | ARIA compliance tag for screen readers. |

Utility Formatters: QRCodeFormatters

  • QRCodeFormatters.text(text)
  • QRCodeFormatters.link(url)
  • QRCodeFormatters.phone(number)
  • QRCodeFormatters.email(address, subject?, body?)
  • QRCodeFormatters.wifi(ssid, password?, encryption?, hidden?)
  • QRCodeFormatters.json(data)

🌍 Community

Join the glimlang developer community and help us build amazing tools!


💖 Contributing

We welcome PRs to make this package even better!

  1. Clone repository
  2. npm install
  3. Modify logic in src/
  4. Run npm run build

📄 License

MIT License. Created with ❤️ by glimlang.xyz for the open-source community.