# Library API reference

URL: https://qrdx.dev/docs/api-reference
Source: https://github.com/qrdxinc/qrdx/blob/main/apps/docs/content/docs/api-reference.mdx

Every entry point, component, function, constant and type the qrdx package exports, with types and defaults. For HTTP endpoints, see the REST API.

This page lists what `qrdx` exports, by entry point and by task, with each prop's type and default. The feature pages explain how to use them; this one is for looking a name up.

> This page describes qrdx 0.0.66. Run `npm view qrdx version` to see the version npm installs.

## Entry points [#entry-points]

| Import from | What it has | Needs |
| --- | --- | --- |
| `qrdx` | The React components (`QRCode`, `QRCodeSVG`, `QRCodeCanvas`, `getQRAsSVG`) plus everything in `qrdx/core` | `react` 16.8 or newer |
| `qrdx/core` | The whole engine without React: markup, downloads, print files, the scan score, frames, templates, art and types | Nothing |
| `qrdx/vanilla` | `createQRCode`, plus `qrdx/core` | A DOM |
| `qrdx/element` | The `<qrdx-code>` custom element: `QRdxCodeElement`, `defineQRdxCode`, `toQRdxCodeHTML` | A DOM to draw; nothing to render markup |
| `qrdx/element/define` | Registers `<qrdx-code>` on import | A DOM |
| `qrdx/node` | `getQRAsPNG` | `@resvg/resvg-js` or `sharp` |
| `qrdx/vue` | `QRCode`, `QRCodeSVG`, `useQRCode`, plus `qrdx/core` | `vue` 3.3 or newer |
| `qrdx/preact` | `QRCode`, `QRCodeSVG` | `preact` 10 or newer |
| `qrdx/solid` | `QRCode`, `QRCodeSVG` | `solid-js` 1.8 or newer |
| `qrdx/angular` | The `QRCode` component (`<qrdx-qr-code>`), plus `qrdx/core` | `@angular/core` 20 or newer |
| `qrdx/types` | Every type, option list and zod schema, without the renderer | Nothing |

Every framework package is an optional peer dependency: installing `qrdx` never adds one you do not use. `jspdf` is optional too, for PDF.

## Components [#components]

### QRCode [#qrcode]

The component for most uses. `QRProps` plus a simple logo API, rendered as an `<svg>`. It uses no browser-only hooks, so it renders in React Server Components.

```tsx title="components/example.tsx"
import { QRCode } from "qrdx";

<QRCode value="https://example.com" size={256} margin={4} level="H" logo="/logo.png" />;
```

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `value` | `string` | required | The text or URL to encode, exactly as given |
| `size` | `number` | `128` | Width and height in pixels. A frame adds to it; a template fits inside it |
| `scale` | `number` | `1` | Multiplies `size` |
| `level` | `"L" \| "M" \| "Q" \| "H"` | `"Q"` | Error correction: about 7%, 15%, 25% or 30% of the code may be damaged |
| `margin` | `number` | `0` | Quiet zone around the code, in modules. 0 fills the box; give a code that may sit on a dark or busy surface at least 2 (the QR standard asks for 4) |
| `fgColor` | `ColorConfig` | `"#000000"` | Color of the data modules: a CSS color, a gradient or an image fill |
| `bgColor` | `ColorConfig` | `"#FFFFFF"` | Background. `"transparent"` paints none |
| `eyeColor` | `ColorConfig` | `fgColor` | Color of the three corner eyes |
| `dotColor` | `ColorConfig` | `fgColor` | Color of the dot inside each eye |
| `eyeColors` | `EyeColors` | none | Per-eye `outer` and `inner` colors for `topLeft`, `topRight` and `bottomLeft`; each overrides `eyeColor` and `dotColor` |
| `bodyPattern` | `BodyPattern` | `"circle"` | Shape of the data modules, one of 23 |
| `cornerEyePattern` | `CornerEyePattern` | `"gear"` | Shape of the corner eyes, one of 22 |
| `cornerEyeDotPattern` | `CornerEyeDotPattern` | `"circle"` | Shape of the eye dots, one of 22 |
| `moduleScale` | `number` | `1` | Size of each data module, 0.5 to 1. Each pattern stops at the smallest size that still scans (`MODULE_SCALE_FLOOR`) |
| `eyeShapes` | `EyeShapes` | none | Per-eye `{ outer, inner }` shapes for `topLeft`, `topRight` and `bottomLeft`, over `cornerEyePattern` and `cornerEyeDotPattern` |
| `eyeGradient` | `"corner"` or `"code"` | `"corner"` | Where the eyes' gradients run: each eye on its own, or across the whole code like the dots' |
| `bgRadius` | `number` | `0` | Corner radius of the background as a share of the code's width, up to `BG_RADIUS_MAX` (0.5); capped at `BG_RADIUS_QUIET_RATIO` × `margin` modules (`getBgRadiusLimit`) |
| `backdrop` | `string` | none | Solid color outside the rounded corners (see-through without it) |
| `halo` | `QRHalo` | none | `{ color, width }`: a light rim around the dark modules and eyes, `width` in modules (0.1 to 0.5), drawn opaque; only on an opaque background at least as light as `HALO_LIGHT_MIN` (`#d1d5db`). Any `color` is taken: one darker than `#d1d5db` or lighter than the background is drawn in the closest color between the two (`fitHaloColor`) |
| `shadow` | `QRShadow` | none | `{ color, opacity, dx, dy }`: a see-through copy of the dark shapes under them, shifted `dx`/`dy` modules (−0.3 to 0.3) at `opacity` (0.1 to 0.4) |
| `logo` | `string` | none | A path, URL or data URL drawn in the middle, with the modules behind it cleared. No logo is drawn without it |
| `logoOptions` | `LogoOptions` | none | The logo's `size` (0.1 to 0.3, default 0.25), `padding` (0 to 2 modules), `x` and `y` (0 to 1), `shape` and `plate` |
| `hideLogo` | `boolean` | `false` | Hides the logo even when `logo` is set |
| `autoLevel` | `boolean` | `false` | Raises `level` to `H` when the logo covers more than 7% of the code (`AUTO_LEVEL_LOGO_COVERAGE`) |
| `exactLevel` | `boolean` | `false` | Encodes at exactly the level the code is drawn at. Without it the encoder raises `level` to `Q` or `H` whenever the data still fits the same version. A Swiss QR-bill must be `M`, so QRdx sets it for those |
| `frame` | `AnyQRFrame` | none | A call-to-action frame: `{ style, text, color, textColor, secondaryText, secondaryColor, fontScale }`, or `{ style: "custom", spec }`. The output grows to fit it |
| `customTemplate` | `TemplateDefinition` | none | Artwork you draw in code around the code, at `size` with the code inside it. See [Templates](#templates) |
| `customProps` | `Record<string, any>` | none | Props for the template's `wrapper` |
| `shape` | `"square" \| "circle" \| "heart" \| QRSilhouette` | `"square"` | Puts the code in a disc, a heart or your own outline filled with decorative modules |
| `art` | `QRArt` | none | Blends a picture into the modules: `{ mode, image, intensity, variant, matchEyes }` |
| `style` | `CSSProperties` | none | Inline styles for the `<svg>` |
| `frameLabelMarkers` | `boolean` | `false` | For editors: marks each frame label `<text>` with `data-qrdx-frame-label`. Exports never include it |
| `partMarkers` | `boolean` | `false` | For editors: marks the drawn parts with `data-qrdx-part`. Exports never include it |
| `isOGContext` | `boolean` | `false` | Draws the logo as a positioned `<img>` for Open Graph image renderers |

`QRCode` and `QRCodeSVG` put any other prop (`className`, `aria-label`, `role`, `data-*`, …) on the `<svg>`, or on the frame's outer `<svg>` when there is a frame. `QRCode` does this from qrdx 0.0.56; older versions drop those props. Event handlers are left out of the markup.

### QRCodeSVG [#qrcodesvg]

`QRProps` plus React's SVG attributes (`QRPropsSVG`): the same props as `QRCode` without `logo`, `logoOptions`, `hideLogo` and `scale`. The logo is `imageSettings`, in pixels:

| Field | Type | Default | What it does |
| --- | --- | --- | --- |
| `src` | `string` | required | The image, as a URL or data URL |
| `width`, `height` | `number` | required | Size in the same pixels as `size` |
| `excavate` | `boolean` | required | Clears the modules behind the image |
| `x`, `y` | `number` | centered | Top left corner of the image |
| `padding` | `number` | `0` | Extra clear space around the image, in pixels, when excavating |
| `shape` | `"square" \| "rounded" \| "circle"` | `"square"` | Crops the image |
| `plate` | `string` | none | A solid plate behind the image, in its shape |

A logo bigger than the code can repair is shrunk around its center (`capImageSettings`, the same budget as `QRCode`).

### QRCodeCanvas [#qrcodecanvas]

`QRProps` plus React's canvas attributes (`QRPropsCanvas`), drawn on a `<canvas>` at the device's pixel ratio. It draws plain square modules with solid colors: a gradient falls back to its first stop, and the pattern, eye color, `eyeColors`, `eyeShapes`, `moduleScale`, `halo`, `shadow`, `art` and template props are ignored (`bgRadius` and `backdrop` are drawn). It ships with `"use client"`.

### getQRAsSVG [#getqrassvg]

`getQRAsSVG(props: QRPropsSVG): Promise<JSX.Element>` returns the code as a React element with its logo embedded as a data URL. For a string, use `toSVGString` or `getSVGString`.

## Download and export [#download-and-export]

| Function | Returns | Notes |
| --- | --- | --- |
| `downloadQRCode(props, { format, size, filename?, quality? })` | `Promise<void>` | Saves a file. `size` is 50 to 5000 px and square; the default file name states the pixel size for raster formats |
| `getQRCodeDataUrl(props, format, size, { quality? })` | `Promise<string>` | The same file as a data URL |
| `getQRAsWebP(props, { quality? })` | `Promise<Blob>` | Lossless unless `quality` is set; encodes itself where the browser cannot |
| `getQRAsBMP(props)` | `Promise<Blob>` | A 24-bit BMP; a transparent background comes out white. Written by the library in every browser |
| `getQRAsGIF(props)` | `Promise<Blob>` | A GIF of at most 256 colors, with a transparent background kept as the one transparent color. A design that needs more colors is reduced, and throws a `GIFScanError` when the reduced image would no longer scan. Written by the library in every browser |
| `getQRAsICO(props, sizes?)` | `Promise<Blob>` | A favicon: the code at 16, 32, 48 and 256 px (or `sizes`, up to 256), each a PNG in the ICO. Transparency kept, a frame left out |
| `getQRAsTIFF(props, { colorMode?, dpi? })` | `Promise<Blob>` | A TIFF at 300 dpi (or `dpi`): RGBA with transparency, or `colorMode: "cmyk"` for print (black as K only, transparency over white, no ICC profile). Written by the library in every browser |
| `copyQRCodeToClipboard(props, size?)` | `Promise<void>` | A PNG on the clipboard. Call it from a user gesture |
| `getSVGString(props)` | `Promise<string>` | SVG markup with the logo embedded |
| `toSVGString(props)` | `string` | SVG markup, synchronous, no logo embedding. Runs anywhere |
| `toSVGElement(props, document?)` | `SVGSVGElement` | The code as a DOM element |
| `getQRAsSVGDataUri(props)` | `Promise<string>` | `data:image/svg+xml,…`, the first step of every export |
| `getQRAsCanvas(props, mimeType, getCanvas?)` | `Promise<string \| HTMLCanvasElement>` | A data URL, or the canvas itself with `getCanvas` |
| `getQRAsPNG(props, { size?, loadExternalLogos? })` | `Promise<Uint8Array>` | PNG bytes in Node, from `qrdx/node`. Needs `@resvg/resvg-js` or `sharp` |
| `validateSize(width, height)` | `{ isValid, error? }` | The size rule `downloadQRCode` applies |
| `getDownloadFilename(format, size, frame?)` | `string` | The default file name |
| `withQRSize(props, size)` | `QRProps` | The props drawn at `size`, with a pixel logo scaled along |
| `canvasToWebP(canvas, { quality? })`, `blobToDataUrl(blob)`, `encodeWebPLossless(rgba, width, height)` | | WebP helpers |
| `canvasToBMP(canvas)`, `encodeBMP(rgba, width, height)`, `isBMPFile(bytes)` | | BMP helpers |
| `canvasToGIF(canvas, expected?)`, `pixelsToGIF(pixels, expected?)`, `encodeGIF(image)`, `quantizeRGBA(rgba, width, height)`, `isGIFFile(bytes)`, `GIFScanError` | | GIF helpers |
| `canvasToICO(canvas)`, `canvasesToICO(canvases)`, `encodeICO(images)`, `isICOFile(bytes)` | | ICO helpers |
| `canvasToTIFF(canvas, options?)`, `encodeTIFF(rgba, width, height, options?)`, `isTIFFFile(bytes)` | | TIFF helpers |

Constants: `DownloadFormat` is `"png" \| "jpg" \| "webp" \| "bmp" \| "ico" \| "gif" \| "tiff" \| "tiff-cmyk" \| "svg" \| "pdf" \| "eps"`; `DOWNLOAD_FORMATS` maps each to its MIME type and extension; `PRESET_SIZES` has `small` (200), `medium` (400), `large` (800), `xlarge` (1200), `2xl` (1600) and `3xl` (2000); `DEFAULT_SIZE` is 128.

## Print and EPS [#print-and-eps]

| Function | Returns | Notes |
| --- | --- | --- |
| `getPrintLayout(props, { size, unit?, bleed?, cropMarks?, colorMode? })` | `PrintLayout` | Physical sizes in mm: `codeWidth`, `trimWidth`, `trimHeight`, `bleed`, `pageWidth`, `pageHeight`, `moduleSize`, `moduleCount`, `maxScanDistance`. `size` is 5 mm to 2 m |
| `getQRAsPrintPDF(props, options)` | `Promise<string>` | A vector PDF as a data URL. Needs `jspdf` |
| `getQRAsPrintPDFBuffer(props, options)` | `Promise<ArrayBuffer>` | The same PDF as bytes, for Node |
| `getQRAsPrintSVG(props, { size, unit? })` | `Promise<string>` | SVG with `width` and `height` in mm or in |
| `downloadPrintPDF(props, options & { filename? })`, `downloadPrintSVG(props, options & { filename? })` | `Promise<void>` | Browser downloads of the two |
| `getQRAsEPS(props, { sizeMm?, bleedMm?, colorMode? })` | `Promise<string>` | EPSF-3.0 text. Throws `EPS_IMAGE_FILL_REASON` for an image fill |
| `downloadPrintEPS(props, options & { filename? })` | `Promise<void>` | Browser download |
| `svgToEPS(svg, { width?, colorMode?, bleed?, bleedColor?, title? })` | `Promise<string>` | Converts any SVG the library renders |
| `epsToDataUrl(eps)`, `hasImageFill(props)`, `rgbToCmyk(color)`, `getQRModuleCount(props)` | | Helpers |

`PrintOptions`: `size` (number), `unit` (`"mm"` or `"in"`, default `"mm"`), `bleed` (mm, 0 to 20), `cropMarks` (boolean), `colorMode` (`"rgb"` or `"cmyk"`).

## Scan score and detection [#scan-score-and-detection]

| Function | Returns | Notes |
| --- | --- | --- |
| `getScanScore(props, { sizes?, signal? })` | `Promise<ScanScoreResult>` | `{ score, grade, checks }`. Browser only; loads jsQR on demand. Default sizes 96, 160 and 320 px (`SCAN_TEST_SIZES`) |
| `getImageScanScore(imageOrBlob, options?)` | `Promise<ImageScanScoreResult>` | The same for an existing image, plus `data` and `version`. Browser only |
| `getScanScoreFromPixels(props, pixels, { sizes?, signal? })` | `Promise<ScanScoreResult>` | `getScanScore` for a design you rasterized yourself (RGBA pixels with the code at least `PIXEL_SCORE_MIN_CODE_WIDTH`, 640 px, wide), in Node |
| `drawScanFrames(props, { sizes?, signal? })` | `Promise<ScanFrames>` | Draws the frames `getScanScore` decodes, on the page's canvas. Browser only |
| `getScanScoreFromFrames(props, frames, { signal? })` | `Promise<ScanScoreResult>` | `getScanScore`'s result from those frames. No DOM, so it runs in a Web Worker. See [Scoring in a Web Worker](https://qrdx.dev/docs/features/frames#scoring-in-a-web-worker) |
| `scanQRPixels(pixels, expected, { sizes? })` | `Promise<PixelScanResult>` | Checks that pixels decode to `expected`, as they are and through the camera model. Node |
| `getScanContrast(props)` | `{ ratio, required, inverted }` | The contrast check on its own |
| `getStylePairRisk(props)` | `StylePairRisk \| null` | A shape pair some scanners miss, with a `fix` |
| `handleImageLoad(img, size, returnFullData?)` | `Promise<string \| QRCode \| "NO_QR">` | Decodes a QR code from an `<img>`. See [QR detection](https://qrdx.dev/docs/qr-detection) |
| `downloadImageWithBoundingBox(img, corners, filename)` | `void` | Saves the image with the found code outlined |

Grades are `"great"`, `"ok"`, `"risky"` and `"fails"`. Each check is `{ id, passed, message, fix?, skipped? }`. Contrast lines: `SCAN_CONTRAST_MIN` 4.5, `SCAN_CONTRAST_LOW` 3, `SCAN_CONTRAST_FAIL` 1.5, and `SCAN_IMAGE_CONTRAST_MIN` 7 for a picture in the code and 12 behind it. The weak pairs ship as `WEAK_BODY_EYES`, `WEAK_DOT_EYES`, `WEAK_SHARP_DOT_EYES`, `SHARP_DOT_EYE_SAFE_BODIES`, `WEAK_EYES` and `WEAK_DOTS`.

## Logos [#logos]

| Function | Returns | Notes |
| --- | --- | --- |
| `getQRData(props)` | the props with `imageSettings` | Lays `logo` and `logoOptions` out for a 1024 px code, capped to the error-correction budget |
| `resolveQRCodeProps(props)` | `QRSVGOptions` | `QRCode`'s props as what the renderer draws, `scale` applied |
| `getLogoSizeLimit({ value, level, margin, shape, autoLevel, exactLevel, logoOptions })` | `number` | The largest `logoOptions.size` that fits, or 0 |
| `getLogoBlockDamage(...)`, `logoFitsBudget(...)`, `getCodewordMap(...)`, `damagedCodewords(...)` | | The budget's parts. `LOGO_EC_SAFETY` is 0.6 |
| `removeLogoBackground(src)` | `Promise<string \| null>` | The logo with its solid background removed, as a PNG data URL. Browser |
| `removeLogoBackdrop(pixels)` | `LogoPixels \| null` | The same on RGBA pixels, anywhere |

Limits: `LOGO_SIZE_MIN` 0.1, `LOGO_SIZE_MAX` 0.3, `LOGO_SIZE_DEFAULT` 0.25, `LOGO_PADDING_MAX` 2, `LOGO_SHAPES` (`square`, `rounded`, `circle`).

## Frames [#frames]

| Export | What it is |
| --- | --- |
| `BUILT_IN_FRAMES` | Every built-in frame: `{ style, name, tags, labelOn, spec }`, in picker order |
| `BUILT_IN_FRAME_SPECS`, `getBuiltInFrame(style)` | The specs by style |
| `frameSpecOf(frame)` | The spec a frame draws, or `null` |
| `getFrameColors(frame)` | `{ frame, text, accent }`, from the options or the spec's defaults |
| `getFrameDimensions(size, frame)` | The output `{ width, height }` for a code of `size` px |
| `getFrameLayout(size, frame)`, `getFrameText(frame)`, `getFrameSecondaryText(frame)`, `frameLabels(layout)`, `isFrameActive(frame)` | Layout helpers |
| `OFFICIAL_FRAMES`, `OFFICIAL_FRAME_INDEX`, `getOfficialFrame(id)`, `OFFICIAL_FRAME_COLLECTIONS`, `OFFICIAL_FRAME_COUNT` | The official frame library. The frames are built as a module of their own, so unused they cost nothing |
| `resolveFrameSpec(spec)`, `getFrameSpecIssues(spec)`, `frameSpecSchema` | Checks a spec; `resolveFrameSpec` throws `FrameSpecError` |
| `importFrameSvg(svg, options)` | Turns an SVG drawing into a frame spec, with warnings (`FRAME_IMPORT_LIMITS`) |
| `frameSpecHash(spec)` | A stable hash of a spec |

Constants: `FRAME_STYLES` (the 25 built-in styles plus `none`), `DEFAULT_FRAME_TEXT` (`"Scan me"`), `FRAME_TEXT_MAX_LENGTH` (24), `FRAME_FONT_SCALE_MIN` (0.5), `FRAME_FONT_SCALE_MAX` (1.5), `CUSTOM_FRAME_STYLE` (`"custom"`), `GRADIENT_FRAME_DEFAULTS`.

## Templates [#templates]

A template is artwork you draw in code around the code, for what a frame spec can't hold, such as dots that change from link to link. Pass it as `customTemplate` and its own props as `customProps`. It's a library feature only; [Artwork drawn in code](https://qrdx.dev/docs/features/frames#artwork-drawn-in-code) has an example.

`TemplateDefinition<TCustomProps>` is `{ id, name, description?, wrapper(children, props?, config?) }`. The wrapper gets the code as a 300 by 300 drawing, `{ fgColor, bgColor, ...customProps }` and `{ url, pixelSize }` (`TemplateConfig`), and returns the whole picture, which is drawn at `size`. It gets and returns React elements inside the React components and `QRNode`s elsewhere; a wrapper written with JSX (without hooks) or with `h` works in both. `QRCodeCanvas` ignores templates.

## Shapes and art [#shapes-and-art]

| Export | What it is |
| --- | --- |
| `createQRArtImage(pixels, { maxSize?, square? })` | Samples RGBA pixels into a `QRArtImage`. Anywhere |
| `loadQRArtImage(source, { mode?, maxSize? })` | The same from a file, data URL or `<img>`. Browser |
| `isQRArtActive(art)`, `getQRArtVariant(art)`, `getQRArtColorIssue(props)` | Art helpers |
| `createQRSilhouette(pixels, { mode?, cells? })`, `loadQRSilhouette(source, options?)` | A `QRSilhouette` for `shape`, from pixels or a picture |
| `getQRSilhouetteFit(silhouette)` | `{ ok: true, share }` or `{ ok: false, reason, message }` |
| `isShapedCode(shape)`, `getQRShapePath(...)`, `circleQuietZone(...)`, `getLayoutMargin(...)` | Shape helpers |
| `clampModuleScale(scale, pattern?)`, `MODULE_SCALE_FLOOR` | The smallest `moduleScale` each pattern scans at |
| `getBgRadiusLimit({ value, level, margin, shape })`, `clampBgRadius(...)` | The largest `bgRadius` a code keeps its quiet zone with |
| `eyeShapeOf(props, position)`, `getEyeStyleRisk(props)`, `weakestEyePattern(props)` | Per-eye shapes: the shapes drawn at one eye, and the scan risk across the three |
| `resolveHalo(halo, code?)`, `resolveShadow(shadow)` | A halo or a shadow with its defaults filled in and its values in range (with `code`, the rim in the color drawn on that background, or null where the halo isn't drawn) |
| `fitHaloColor(color, bgColor)`, `haloTints(color, bgColor, count?)` | The color a halo's rim is drawn in on a background (the picked one, or the closest one that scans), or null where no halo is drawn; up to `count` (4) tints of a color that are drawn as they are, darkest first |
| `getHaloRisk({ halo, bgColor })`, `isSeeThroughBackground(bgColor)`, `colorAlpha(color)` | Why a halo isn't drawn on a code (`reason` `see-through`, `picture` or `dark-background`, `message`, `fix`), or `reason: "adjusted"` with the `color` drawn instead of the picked one, or null; whether any of a background's paint is see-through; a color's alpha (hex, `rgb()`, `hsl()`, `none`) |

Constants: `QR_SHAPES` (`square`, `circle`, `heart`), `QR_CIRCLE_QUIET_MIN` (3), `QR_SILHOUETTE_MAX_CELLS` (64), `QR_ART_MODES` (`logo`, `halftone`), `QR_ART_VARIANTS`, `QR_ART_MAX_SAMPLE_SIZE` (192), `DEFAULT_ART_INTENSITY` (0.6).

## Rendering primitives [#rendering-primitives]

The React-free renderer, from `qrdx/core`:

| Export | What it is |
| --- | --- |
| `createQRCodeTree(options)` | The code as plain `{ type, props, key }` nodes (`QRNode`) |
| `renderToString(tree)`, `renderToDOM(tree, document?)` | Markup, or DOM nodes |
| `toHyperscript(tree, createElement)` | The tree as another framework's elements. The Vue and Preact entries are built on it |
| `h(type, props, ...children)`, `Fragment`, `isQRNode(value)` | Build nodes without JSX: a template's wrapper, or the `slot` of `createFrameTree` |
| `getQRAsSVGNode(options)` | `Promise<QRNode>` with the logo embedded |
| `getQRCodeData(props)`, `getQRCodeSVGProps(props, data)` | The two halves of `resolveQRCodeProps` |

## Utilities [#utilities]

`getSolidColor`, `getContrastRatio`, `getContrastLevel`, `getLuminance`, `hexToRgb`, `SUPPORTS_PATH2D`, `getColorString`, `normalizeColorConfig`, `isGradient`, `isImagePaint`, `decodePNGPixels`, `sanitizeFrameText` and `isLatin1Text` are described on [Utilities](https://qrdx.dev/docs/utilities).

## Types and option lists [#types-and-option-lists]

The types below come from `qrdx`, `qrdx/core` and `qrdx/types`. The option lists are plain arrays; the zod schemas (`qrPropsSchema`, `frameSchema`, `frameSpecSchema`, `colorConfigSchema`, `qrArtSchema`, `logoOptionsSchema`, `imageSettingsSchema` and the rest) are built from them.

| Type | Shape |
| --- | --- |
| `QRProps` | The props table above, without the logo API |
| `QRCodeProps` | `QRProps` plus `logo`, `logoOptions`, `hideLogo`, `scale` |
| `QRSVGOptions` | `QRProps` plus any root attribute: what the core draws |
| `ColorConfig` | `string \| SolidColor \| LinearGradient \| RadialGradient \| AngularGradient \| ImagePaint` |
| `LinearGradient` | `{ type: "linear", stops, angle? }`; `angle` in degrees, default 0 |
| `RadialGradient` | `{ type: "radial", stops }` |
| `AngularGradient` | `{ type: "angular", stops, angle? }` |
| `GradientStop` | `{ color, offset }`; `offset` 0 to 100 |
| `ImagePaint` | `{ type: "image", src, fit?, scale?, position?, opacity?, underlay? }` |
| `ImageSettings`, `LogoOptions`, `EyeColors` | As in the tables above |
| `QRFrame` | `{ style: FrameStyle, text?, color?, textColor?, secondaryText?, secondaryColor?, fontScale? }` |
| `QRCustomFrame`, `AnyQRFrame`, `FrameSpec` | `{ style: "custom", spec, ...labels and colors }`, the union, and the spec format |
| `QRArt`, `QRArtImage` | `{ mode, image, intensity?, variant?, matchEyes? }` and `{ width, height, data }` |
| `TemplateDefinition`, `TemplateConfig`, `BaseTemplateProps`, `TemplateNode` | [Templates](#templates) |
| `QRCodeShape`, `QRSilhouette` | `"square" \| "circle" \| "heart"` or `{ type: "silhouette", width, height, cells }` |
| `DownloadFormat`, `DownloadSize`, `DownloadOptions`, `PrintOptions`, `PrintLayout`, `EPSOptions` | Export |
| `ScanScoreResult`, `ImageScanScoreResult`, `ScanCheck`, `ScanGrade`, `StylePairRisk` | The scan score |
| `BodyPattern`, `CornerEyePattern`, `CornerEyeDotPattern`, `FrameStyle`, `ErrorLevel` | The option unions |

Option lists: `BODY_PATTERN`, `CORNER_EYE_PATTERNS`, `CORNER_EYE_DOT_PATTERNS`, `FRAME_STYLES`, `QR_SHAPES`, `LOGO_SHAPES`, `EYE_POSITIONS`. Retired values that still render for saved designs: `RETIRED_CORNER_EYE_PATTERNS` (`curly`) and `RETIRED_CORNER_EYE_DOT_PATTERNS` (`diamond`, `star`, `banner`).

## Where things run [#where-things-run]

- **Anywhere, no DOM:** `toSVGString`, `createQRCodeTree`, `renderToString`, `getQRData`, the frame helpers, `createQRArtImage`, `createQRSilhouette`, `getPrintLayout`, `getQRAsEPS`, `getQRAsPrintPDFBuffer`, `scanQRPixels`, `toQRdxCodeHTML`.
- **Browser:** `downloadQRCode` and the other downloads, `copyQRCodeToClipboard`, `getQRAsCanvas`, `getScanScore`, `getImageScanScore`, `handleImageLoad`, `loadQRArtImage`, `loadQRSilhouette`, `removeLogoBackground`, `createQRCode`, the custom element.
- **Node only:** `getQRAsPNG` from `qrdx/node`.
- **React Server Components:** `QRCode`, `QRCodeSVG` and everything that needs no DOM. `QRCodeCanvas` is a Client Component.

## Related [#related]

- [Basic usage](https://qrdx.dev/docs/usage): The props you set most often, with examples.
- [Utilities](https://qrdx.dev/docs/utilities): The color, contrast and validation helpers.
- [QR detection](https://qrdx.dev/docs/qr-detection): Reading codes from images.
- [REST API and OAuth](https://qrdx.dev/docs/developers/rest-api): The HTTP API, for codes you host.
