New to Telerik UI for BlazorStart a free 30-day trial

Blazor QRCode Overview

The Blazor QRCode component generates Canvas and SVG images that represent Quick Response (QR) codes.

The generated image from the component is a machine-readable label that contains information about data for a locator, identifier, or tracker that points to a website or application.

Creating Blazor QRCode

  1. Add the TelerikQRCode tag to add the component to your razor page.

  2. Set the Value property.

  3. Set its Size property.

  4. Optionally, choose a QRCode Type (one of the types we support).

A basic configuration of the Telerik QRCode

<TelerikQRCode Size="200px"
               Value="https://docs.telerik.com/blazor-ui/introduction">
</TelerikQRCode>

Encoding

Encoding represents the mapping between messages and qr codes. Read more about the supported Blazor QRCode Encodings.

Types

The component exposes Swiss and Image QRCode types. Read more about the supported Blazor QRCode Types...

Methods

The QRCode methods are accessible through its reference.

  • Refresh - redraws the component.

You can see the example with the Barcode and use the Refresh() method in the same way with QRCode.

Parameters

The Blazor Barcode provides various parameters that allow you to configure the component:

ParameterTypeDescription
RenderAsRenderingMode enum
Svg
Defines the preferred rendering mode - svg/canvas.
QRCodeEncodingenumThe encoding mode used to encode the value.
QRCodeErrorCorrectionenumThe error correction level used to encode the value.
ValuestringDefines the initial value of the QRCode.
SizestringSpecifies the size (Width and Height) of a QR code in pixels (i.e. "200px") as the QRCode is a square. You can read more details for the dimension properties in the Dimensions article. Setting both Size and Width and/or Height will throw an error. Setting different values to Width and Height will also cause an issue.
WidthstringSets the width of the QRCode. If Height is set and the Size property is not set, the same value as Width should be set to Height.
HeightstringSets the height of the QRCode. If Height is set and the Size property is not set, the same value as Height should be set to Width.
ClassstringThe CSS class that will be rendered on the main wrapping element of the QRCode component.
BackgroundstringThe background color of the QRCode. Accepts a valid CSS color string, including HEX and RGB.
ColorstringDefines the color of the QRCode elements. The default color is black.
PaddingdoubleDefines the minimum distance in pixels that should be left between the border and the QR modules.

QRCodeOverlay parameters

The nested QRCodeOverlay tag exposes parameters that allow you to choose from predefined layouts or insert a custom image in the Blazor QRCode:

ParameterTypeDescription
QRCodeOverlayTypeenumAvailable options are Image and Swiss. When set to image, you have to specify the url source of the image. If set to swiss, a Swiss QR Code is created.
ImageUrlstringThe URL of the displayed overlay image.
WidthdoubleThe width of the overlay in pixels.
HeightdoubleThe height of the overlay in pixels.

QRCodeBorder parameters

The nested QRCodeBorder tag exposes parameters that enable you to customize the appearance of the Blazor QRCode border:

ParameterTypeDescription
ColorstringThe color of the border. Accepts a valid CSS color string, including HEX and RGB.
WidthdoubleThe width of the border in pixels. By default the border width is set to zero which means that the border will not be visible.

Next Steps

Explore the QRCode Encodings

Explore the QRCode Types

See Also