Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

Authenticator setup

Give the code a title that says what scanning does, because a screen reader announces it in place of the picture.

Authenticator setup
Show code
<app-qr-code value="@otpauthUri" size="200" title="Scan to add your account to an authenticator app" />

Long values

A long signed token still fits in a code, but the code gets denser, so give it more room.

Long values
Show code
<app-qr-code value="@signedToken" size="320" title="Scan to verify this invoice" />

Copy fallback

Put the same value beside the code, so a person who cannot scan can still copy it.

With a copy fallback
Show code
<app-qr-code value="@setupKey" size="160" title="Scan to add your account" />
<app-copy-button text="@setupKey" />

Every option

Every value of every prop, one cell each.

value

a URL
an otpauth URI
a 1,500-character token

size

size="120"
size="180"
(default) size="240"
size="320"

title

(default) title="QR code"
title="Scan to open the site"

className

class="border"

Guidance

What to do, and what to avoid.

Use it when

  • Someone needs to move a link or a code from a screen to a phone.
  • An authenticator app needs a setup key.
  • A printed or on-screen document carries a value a scanner verifies.

Reach for something else when

  • The person is already on a phone. → AppLink
  • The value is a short code people type. → AppCopyButton

Clear title and room to scan

Do

Enough room around it, and a title that says what scanning does.

Avoid

A long value squeezed into a small box. The squares are too small to scan, and part of the code is cut off.

Reference

Try every prop, read the full list, and check keyboard and screen reader behaviour.

120 180 240 320
React, generated from the controls
<AppQrCode value="https://example.com/invoices/INV-1042" />
Razor, the same props
<app-qr-code value="https://example.com/invoices/INV-1042" />

3 props. The 3 most used come first.

Used on most screens 3 props

PropTypeDefaultDescription
valuedefault - string - The text to encode, such as a link, an otpauth setup address or a signed token. Nothing renders while it is empty.
sizedefault 240 int 240 The largest width and height in px. The code draws at the biggest whole number of pixels per module that fits.
titledefault QR code string QR code The accessible name. Say what scanning it does.

Screen reader

3 notes
  • The code is an image named by title, so the title should say what scanning it does.
  • Nothing is drawn while value is empty, so no unnamed image reaches assistive technology.
  • The code is always black on white, whatever the theme, because scanners need that contrast.

Do and avoid

1 pairs

Clear title and room to scan

Do

Enough room around it, and a title that says what scanning does.

Avoid

A long value squeezed into a small box. The squares are too small to scan, and part of the code is cut off.