@qrcodesdk/core is the runtime-neutral foundation of QRCodeSDK.
It turns a payload into a QR code matrix and lets renderers decide how that matrix becomes SVG, terminal text, PNG, DOM output, or any custom format.
Install
Section titled “Install”npm install @qrcodesdk/corepnpm add @qrcodesdk/corevp add @qrcodesdk/coredeno add @qrcodesdk/corebun add @qrcodesdk/coreyarn add @qrcodesdk/coreQuick start
Section titled “Quick start”import {QRCodeSVGRenderer, qrcode} from '@qrcodesdk/core';
const svg = qrcode('https://qrcodesdk.dev').render(QRCodeSVGRenderer());The result is an SVG string. See the SVG renderer reference for its
options and constraints.
What Core adds
Section titled “What Core adds”| Capability | API | Return type |
|---|---|---|
| Generate a QR matrix | qrcode(payload).matrix() |
QRCodeMatrix |
| Render scalable vector output | QRCodeSVGRenderer |
SVG string |
| Render terminal output | QRCodeTextRenderer |
text string |
The complete payload, matrix-option, builder-method, and matrix-output contracts live in Builder and matrix. Shared visual options and scan-reliability guidance live in Customize appearance.
Typed helpers serialize common application values before generation. See Payload helpers for email, phone, SMS, geographic, and Wi-Fi payloads.
Runtime compatibility
Section titled “Runtime compatibility”
@qrcodesdk/coresupports any JavaScript runtime providing native ESM, ES2020 support, and a globalTextEncoder. It has no Node.js, DOM, filesystem, or framework dependency.
| Runtime | Support policy |
|---|---|
| Node.js | All maintained LTS lines |
| Deno | Current stable major |
| Bun | Current stable release |
| Browsers | Current evergreen browser families |
| Other runtimes and edge workers | Supported when they meet the Core runtime contract |
For runtime-specific output, add the owning package:
| Package | Additional output | Output |
|---|---|---|
@qrcodesdk/browser |
Canvas element, PNG-backed Image element, browser downloads | HTMLCanvasElement, HTMLImageElement, void |
@qrcodesdk/node |
PNG bytes | Buffer |
@qrcodesdk/cli |
Command line generation from terminals and scripts. | Terminal text, SVG files, PNG files. |
@qrcodesdk/react |
React SVG, Image, and Canvas components | React element |
@qrcodesdk/vue |
Vue SVG, Image, and Canvas components | Vue component |
@qrcodesdk/svelte |
Svelte SVG, Image, and Canvas components | Svelte component |
@qrcodesdk/angular |
Angular SVG, Image, and Canvas components | Angular component |
Compare every built-in output in Renderer outputs.
Public API
Section titled “Public API”import { QRCodeBuilder, type QRCodeCenterImageOptions, type QRCodeColor, type QRCodeDataImageURL, QRCodeError, type QRCodeErrorCode, type QRCodeErrorCorrectionLevel, type QRCodeFinderShape, type QRCodeMask, type QRCodeMatrix, type QRCodeMatrixOptions, type QRCodeMode, type QRCodeModuleShape, type QRCodePayload, type QRCodeRenderer, type QRCodeSVGAccessibilityOptions, type QRCodeSVGCenterImageOptions, type QRCodeSVGOptions, QRCodeSVGRenderer, type QRCodeSVGRendererOptions, type QRCodeTextANSIBackgroundOptions, type QRCodeTextANSIOptions, QRCodeTextRenderer, type QRCodeTextRendererOptions, type QRCodeTextStyle, type QRCodeVersion, type QRCodeVisualStyle, createQRCodeStyler, qrcode,} from '@qrcodesdk/core';import type { QRCodeStyledDrawing, QRCodeStyledDrawingTarget, QRCodeStyler,} from '@qrcodesdk/core/drawing';import { type QRCodeEmailPayload, type QRCodeGeoPayload, type QRCodePhonePayload, type QRCodeSMSPayload, type QRCodeWiFiEncryption, type QRCodeWiFiPayload, emailPayload, geoPayload, phonePayload, smsPayload, wifiPayload,} from '@qrcodesdk/core/payload';Drawing types and payload helpers are deliberately not re-exported from the package root. Import them from the stable subpath entry points shown above.
Generated output stability
Section titled “Generated output stability”Output is deterministic for one installed implementation, but matrix modules, SVG markup, and PNG bytes may change between QRCodeSDK releases. Pin exact package versions and keep fixtures when exact artifacts matter. See the version and output policy.