Skip to content

Commit 0bc6eb2

Browse files
committed
add QR code docs
1 parent ff1d6a2 commit 0bc6eb2

5 files changed

Lines changed: 90 additions & 3 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: "Template Editor: QR Code block"
3+
slug: changelog/2026-10-02-template-editor-qr-code-block
4+
description: "Add QR codes to visual templates with variable URLs or text, custom colors, and configurable error correction."
5+
section: Changelog
6+
tableOfContents: false
7+
changelog:
8+
date: '2026-10-02'
9+
anchor: template-editor-qr-code-block
10+
sidebar:
11+
hidden: true
12+
---
13+
14+
Add scannable URLs or text to your templates with the new **QR Code** block. Choose **QR Code** in the Template Editor's left sidebar, then enter the content in the right sidebar. Connect Content to a variable to generate a different QR code for each image through `template_values`.
15+
16+
Customize the foreground color and background, choose from four error correction levels, and adjust the quiet zone around the code. New blocks start with black modules on a white background, Medium error correction, and a four-module quiet zone.
17+
18+
See the [QR Code block documentation](/template-editor/blocks/qr-code/) for controls, sizing guidance, and an example using variable content.
19+
20+
[All updates](/changelog/)

‎src/content/docs/template-editor/blocks/index.mdx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: >-
66
---
77
<a id="blocks" />
88

9-
Blocks are the pieces that make up a template: text, images, shapes, HTML, and layout containers.
9+
Blocks are the pieces that make up a template: text, images, shapes, QR codes, HTML, and layout containers.
1010

1111
Add blocks from the left sidebar. Once a block is on the canvas, select it to edit its properties in the right sidebar.
1212

@@ -20,6 +20,7 @@ Blocks can sit directly on the canvas or inside panels. Panel blocks are useful
2020
| [Simple Text](/template-editor/blocks/simple-text/) | Text with one shared style, auto font sizing, and direct templating |
2121
| [Image](/template-editor/blocks/image/) | Media library images, image URLs, and Pexels stock photos |
2222
| [Shape](/template-editor/blocks/shape/) | Rectangles, circles, triangles, stars, and simple graphic marks |
23+
| [QR Code](/template-editor/blocks/qr-code/) | Scannable URLs or text, with variable content and configurable error correction |
2324
| [HTML](/template-editor/blocks/html/) | Custom markup inside a visual template |
2425
| [Free Panel](/template-editor/blocks/free-panel/) | A grouped area where children keep free positioning |
2526
| [Flex Panel](/template-editor/blocks/flex-panel/) | Rows, columns, and dynamic stacks |
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: QR Code
3+
slug: template-editor/blocks/qr-code
4+
description: Encode URLs or text as QR codes, with variable content, colors, and error correction settings.
5+
---
6+
import CommonBlockOptions from '../../../../components/CommonBlockOptions.astro';
7+
8+
<a id="qr-code-block" />
9+
10+
Use QR Code blocks to add scannable links or text to product cards, event graphics, certificates, and other templates. Choose **QR Code** in the left sidebar, then edit **Content** in the right sidebar.
11+
12+
## How it works
13+
14+
The block encodes its Content as a QR code and renders it as SVG in the template. Enter a URL such as `https://example.com/event`, or any non-empty text. The encoded content can come from a variable, so each generated image can have a different QR code.
15+
16+
New blocks start at 240 × 240 pixels with a locked square aspect ratio, black modules, and a white background. The default Content is `https://htmlcsstoimage.com`.
17+
18+
<CommonBlockOptions />
19+
20+
## Block-specific properties
21+
22+
| Property | Details | Variables |
23+
| --- | --- | --- |
24+
| Content | URL or text to encode. Must not be empty or contain only whitespace. | Yes |
25+
| Color | Foreground color of the QR modules. Defaults to black (`#000000`). | Yes |
26+
| Error correction | Low (L), Medium (M), Quartile (Q), or High (H). Defaults to Medium (M). | — |
27+
| Quiet zone (modules) | Clear margin around all four sides of the code, measured in module widths. Integer from 4 to 32; defaults to 4. | — |
28+
| Padding | Additional space inside the block edge. Simple mode sets all sides; Advanced mode sets each side. | — |
29+
| Opacity | Transparency of the whole block, including content and styling. | Yes |
30+
31+
Use the common **Background** controls to change the white background separately from the QR foreground color.
32+
33+
## Error correction and content limits
34+
35+
Higher error correction levels provide more redundancy, but leave less capacity for content and can make the code denser. Medium (M) is the default; choose another level in the right sidebar when needed.
36+
37+
The amount of content that fits depends on the text and selected error correction level. If the editor reports that the content is too long, shorten it or choose a lower error correction level. Fixed content and saved fallback content are validated before saving; variable content is checked when previewing or rendering.
38+
39+
## Quiet zone and sizing
40+
41+
A module is one small square in the QR pattern. The quiet zone reserves a clear margin around the pattern so scanners can distinguish the code from surrounding content. Keep at least the default four modules on every side; padding adds space beyond this margin.
42+
43+
Keep the foreground dark and the background light, leave the quiet zone clear, and use a size that keeps individual modules visible in the final image. Scan the generated image at its intended display or print size to check the result.
44+
45+
## Example usage
46+
47+
To generate a different destination for each image:
48+
49+
1. Add a QR Code block and click the hard-hat icon beside **Content**.
50+
2. Set its template key to `qr_url` and its variable mode to **Required**.
51+
3. In the Variables tab, provide a test URL and turn **Preview** on to check the code.
52+
4. Save the template, then pass the URL in `template_values` when [creating an image with a template](/getting-started/templates/#creating-an-image-with-a-template).
53+
54+
```json
55+
{
56+
"template_id": "YOUR_TEMPLATE_ID",
57+
"template_values": {
58+
"qr_url": "https://example.com/events/launch-day"
59+
}
60+
}
61+
```
62+
63+
Connect Content directly to a property variable rather than putting Handlebars syntax in the field. See [Variables](/template-editor/variables/) for template keys and preview controls.
64+
65+
Use **Fallback** to encode the saved Content when a value is missing or empty. Use **Ignore** to omit the QR block from the generated output when its content is missing or empty. Required content must resolve to a non-empty value that fits at the selected error correction level.

‎src/content/docs/template-editor/index.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Open it from the dashboard by creating or editing a template. The canvas is the
2828

2929
- Reusable social images, product graphics, certificates, reports, cards, and other image layouts
3030
- Variable-driven text, image URLs, colors, numbers, and other render-time values
31-
- Layouts made from text, images, shapes, HTML, and panel blocks
31+
- Layouts made from text, images, shapes, QR codes, HTML, and panel blocks
3232
- Templates that can be adjusted visually and rendered through the API
3333

3434
## Editor areas
@@ -48,7 +48,7 @@ Open it from the dashboard by creating or editing a template. The canvas is the
4848
| [Quick Start](/template-editor/quick-start/) | Build, preview, save, and render a template |
4949
| [Canvas](/template-editor/canvas/) | Set image size, canvas styling, and image settings |
5050
| [Variables](/template-editor/variables/) | Connect render-time values to template fields |
51-
| [Blocks](/template-editor/blocks/) | Choose text, media, shape, HTML, and panel blocks |
51+
| [Blocks](/template-editor/blocks/) | Choose text, media, shape, QR code, HTML, and panel blocks |
5252
| [Advanced](/template-editor/advanced/) | Layout behavior, panels, sizing, positioning, and Extra CSS |
5353

5454

‎src/navigation.mjs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ const navigation = [
6868
{ label: 'Simple Text', link: '/template-editor/blocks/simple-text/' },
6969
{ label: 'Image', link: '/template-editor/blocks/image/' },
7070
{ label: 'Shape', link: '/template-editor/blocks/shape/' },
71+
{ label: 'QR Code', link: '/template-editor/blocks/qr-code/' },
7172
{ label: 'HTML', link: '/template-editor/blocks/html/' },
7273
{ label: 'Free Panel', link: '/template-editor/blocks/free-panel/' },
7374
{ label: 'Flex Panel', link: '/template-editor/blocks/flex-panel/' },

0 commit comments

Comments
 (0)