ZYVOPMulti-Platform Sync
SeriesAI NewsWhy ZyVOPJoin Discord
LoginGet Started
ZYVOPMulti-Platform Sync

The Developer Publishing Hub. Write once, publish everywhere, and make your work citation-ready with built-in SEO, AEO, and GEO discovery support. Zero reader paywalls.

Content

  • Categories
  • Tags
  • Badges
  • Leaderboard
  • Write Article
  • Newsletter

Company

  • About Us
  • Why ZyVOP
  • Developer API & CLI
  • Write for Us
  • Contact

Connect

  • Privacy Policy
  • Terms of Service
  • Cookie Policy
  • DMCA Policy
  • Code of Conduct

ยฉ 2026 ZyVOP. Developer Publishing Hub.

Zero paywalls ยท Full content ownership
All systems operational
HomeMantine QR Code - A Real QR Code Generator for Mantine

Mantine QR Code - A Real QR Code Generator for Mantine

Giovambattista Fazioli
Giovambattista Fazioli
Senior Full-stack Engineer, Lead DeveloperSupport
September 4, 2026
4 min read
Mantine QR Code - A Real QR Code Generator for Mantine
#react#TypeScript#webcomponents#uidesign

Generate fully scannable, beautifully styled QR codes with custom dot shapes, finder patterns, image overlays, and one-click SVG/PNG download โ€” all integrated with the Mantine design system.

Introduction

The Mantine QR Code component has been completely rebuilt from the ground up. What was previously an LED-style indicator has been transformed into a fully functional QR code generator that produces real, scannable codes from any string input. It renders pure SVG for crisp output at any resolution, follows Mantine's Styles API conventions, and ships with a dedicated download hook for exporting to SVG, PNG, JPEG, or WebP.

Mantine QR Code

โœจ New Features

Real QR Code Generation

The component now encodes actual QR code data using the qrcode library. Pass any string โ€” a URL, WiFi credentials, vCard, plain text โ€” and get a scannable QR code rendered as optimized SVG.

import { QRCode } from '@gfazioli/mantine-qr-code';

function Demo() {return <QRCode value="https://mantine.dev" />;}

Enter fullscreen mode Exit fullscreen mode

The value prop is the only required prop. Everything else has sensible defaults.

Dot Styles

Control the appearance of data modules with the dotStyle prop. Three built-in styles are available:

<QRCode value="https://mantine.dev" dotStyle="square" />   {/* Default */}<QRCode value="https://mantine.dev" dotStyle="rounded" /><QRCode value="https://mantine.dev" dotStyle="dots" />

Enter fullscreen mode Exit fullscreen mode

Each style generates a single combined <path> element for all data modules, keeping the DOM lightweight even for dense QR codes.

Corner Styles

The three finder patterns (the large squares in the corners) can be styled independently with cornerStyle:

<QRCode value="https://mantine.dev" cornerStyle="square" />   {/* Default */}<QRCode value="https://mantine.dev" cornerStyle="rounded" /><QRCode value="https://mantine.dev" cornerStyle="dots" />

Enter fullscreen mode Exit fullscreen mode

Mix and match dot and corner styles for unique designs:

<QRCodevalue="https://mantine.dev"dotStyle="dots"cornerStyle="rounded"color="violet"/>

Enter fullscreen mode Exit fullscreen mode

Image Overlay with Excavation

Add a logo or image at the center of the QR code. The component automatically removes ("excavates") the data modules behind the image to keep the code scannable:

<QRCodevalue="https://mantine.dev"size="xl"image="https://example.com/logo.png"imageSize={0.2}imageRadius="md"imagePadding={1}imageExcavate={true}errorCorrectionLevel="H"/>

Enter fullscreen mode Exit fullscreen mode

Tip: Use errorCorrectionLevel="H" when overlaying images โ€” it provides 30% error correction, ensuring the code remains scannable even with a portion covered.

Error Correction Levels

Four standard error correction levels are supported via the errorCorrectionLevel prop:

Level

Recovery

Best for

L

~7%

Dense data, minimal damage expected

M

~15%

General use (default)

Q

~25%

Moderate resilience

H

~30%

Image overlays, printed codes

useQRCodeDownload Hook

A dedicated hook makes it easy to export the QR code in multiple formats:

import { QRCode, useQRCodeDownload } from '@gfazioli/mantine-qr-code';

function Demo() {const { ref, download, getDataUrl } = useQRCodeDownload({
    fileName: 'my-qr-code',
    scale: 4,          // 4x resolution for raster formats});

  return (
    <>
      <QRCode ref={ref} value="https://mantine.dev" />
      <button onClick={() => download({ format: 'svg' })}>Download SVG</button>
      <button onClick={() => download({ format: 'png' })}>Download PNG</button>
    </>);}

Enter fullscreen mode Exit fullscreen mode

Supported formats: svg, png, jpeg, webp. The getDataUrl function returns a data URL โ€” useful for preview thumbnails or embedding.

Theme-Aware Colors

Both foreground and background colors integrate with the Mantine theme:

<QRCode value="https://mantine.dev" color="blue" background="gray.1" /><QRCode value="https://mantine.dev" color="white" background="dark" /><QRCode value="https://mantine.dev" color="teal" background="transparent" />

Enter fullscreen mode Exit fullscreen mode

Full Styles API

The component exposes 8 style selectors for granular customization:

Selector

Element

Description

root

<div>

Outer container

svg

<svg>

SVG element

background

<rect>

Background rectangle

modules

<path>

Combined data modules path

finderPattern

<g>

Finder pattern group (ร—3)

finderOuter

<path>

Outer ring of finder pattern

finderInner

<path>

Inner square of finder pattern

image

<image>

Center image overlay

CSS Variables

Variable

Description

--qr-code-size

Width and height

--qr-code-radius

Container border radius

--qr-code-color

Foreground (module) color

--qr-code-background

Background color

Size presets: xs (80px), sm (120px), md (160px), lg (200px), xl (256px).

๐Ÿ”ง Improvements

  • SVG Accessibility: The SVG element includes role="img" and an aria-label derived from the encoded value.

  • Optimized Rendering: All data modules are combined into a single <path> element, keeping the DOM minimal regardless of QR code density.

  • Memoized Computation: QR matrix generation and SVG path building are wrapped in useMemo โ€” re-computation only happens when relevant props change.

  • SSR Compatible: No browser-only APIs (window, document) are used during rendering. The download hook uses browser APIs only when explicitly called.

๐Ÿ“– Complete Props Reference

interface QRCodeBaseProps {value: string;                              // Required โ€” data to encodesize?: MantineSize | string | number;       // Default: 'md'radius?: MantineRadius | string | number;   // Container border radiuscolor?: MantineColor;                       // Default: 'dark'background?: MantineColor | 'transparent';  // Default: 'white'errorCorrectionLevel?: 'L' | 'M' | 'Q' | 'H'; // Default: 'M'quietZone?: number;                         // Default: 1dotStyle?: 'square' | 'rounded' | 'dots';  // Default: 'square'cornerStyle?: 'square' | 'rounded' | 'dots'; // Default: 'square'image?: string;                             // Center image URLimageSize?: number;                         // 0โ€“1, default: 0.2imageRadius?: MantineRadius | string | number;imagePadding?: number;                      // Default: 1imageExcavate?: boolean;                    // Default: true}

Enter fullscreen mode Exit fullscreen mode

Getting Started

Install the package:

npm install @gfazioli/mantine-qr-code

Enter fullscreen mode Exit fullscreen mode

Import styles at the root of your application:

import '@gfazioli/mantine-qr-code/styles.css';

Enter fullscreen mode Exit fullscreen mode

Use the component:

import { QRCode } from '@gfazioli/mantine-qr-code';

function App() {return (
    <QRCode
      value="https://mantine.dev"
      size="lg"
      dotStyle="rounded"
      cornerStyle="rounded"
      color="blue"
    />);}

Enter fullscreen mode Exit fullscreen mode

Use Cases

Use Cases


{/* URL */}<QRCode value="https://mantine.dev" />

{/* WiFi credentials */}<QRCode value="WIFI:T:WPA;S:MyNetwork;P:MyPassword;;" />

{/* vCard contact */}<QRCode value="BEGIN:VCARD\nVERSION:3.0\nFN:John Doe\nTEL:+1234567890\nEND:VCARD" />

Enter fullscreen mode Exit fullscreen mode

Links

  • ๐Ÿ“ฆ npm package

  • ๐Ÿ“– Documentation & Demos

  • ๐Ÿ”— GitHub Repository

  • ๐Ÿงฉ More Mantine Extensions

Comments (0)

Login to post a comment.

Giovambattista Fazioli
Giovambattista Fazioli

Senior Full-stack Engineer, Lead Developer

Italian Senior Full-stack Engineer and Lead Developer on the Cloud team at Namecheap. I build developer tools, React/Mantine UI components and native macOS apps โ€” mostly open source. I work across TypeScript, Next.js, Go and SwiftUI, and I've been coding since the Commodore/Assembly days. Creator of WP Bones and 25+ Mantine extensions, and maintainer of the Undolog open-source studio.

Support
Subscribe to Giovambattista Fazioli's Newsletter

More from Giovambattista Fazioli

View profile

FinderGit 0.29.0 โ€” open a commit like a folder

Thereโ€™s a moment, reading a commit list, where you want to know one small thing: which files did that one touch?

3 minSep 4

Netfox 0.18.0 โ€” is it my connection, or the internet?

There is a question that comes up every time something feels slow, and until now Netfox could not...

3 minSep 4

Mantine Book โ€” Grab Any Edge, Turn Any Page

A realistic iBooks-style book for React built on Mantine: stack two-sided pages and turn them by...

5 minSep 4

Netfox โ€” The macOS app that never loses track of your network

I built Netfox because every existing answer to "what's actually on my network?" annoyed me. The...

5 minSep 4

Audio That Sees Itself

A Mantine-native audio player for React with waveform visualisation and a live spectrum analyser,...

5 minSep 4