RadzenQRCode Class

A QR code generator component that creates scannable QR codes from text, URLs, or other data as SVG graphics. RadzenQRCode supports extensive customization including colors, shapes, error correction, and embedded logos. Encodes data in a two-dimensional barcode format scannable by smartphones and QR code readers. Generates QR codes entirely client-side as SVG, with no external dependencies. Features data encoding (text, URLs, contact info, WiFi credentials, or any string data), error correction levels (Low, Medium, Quartile, High) for different damage resistance, customization of colors for modules (dots) and background with custom shapes (Square, Rounded, Circle), optional logo/image embedding in the center of the QR code, eye styling to customize the appearance of the three corner finder patterns, and responsive size (percentage or pixel-based) for responsive layouts. Higher error correction levels allow the QR code to remain scannable even when partially damaged or obscured (e.g., by a logo). Use Quartile or High error correction when embedding logos.

Inheritance

Object

ComponentBase

RadzenComponent

RadzenQRCode

Implements

IComponent

IHandleEvent

IHandleAfterRender

Namespace: Radzen.Blazor

Assembly: Radzen.Blazor.dll

Syntax

public class RadzenQRCode : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender

Examples

Basic QR code for URL:

<RadzenQRCode Value="https://radzen.com" Size="200px" />

Customized QR code with logo:

<RadzenQRCode Value="https://example.com" Foreground="#4169E1" Background="#F0F0F0"
              Image="logo.png" ImageSizePercent="25" Ecc="RadzenQREcc.High"
              ModuleShape="QRCodeModuleShape.Rounded" Size="300px" />

Constructors

RadzenQRCodelink

A QR code generator component that creates scannable QR codes from text, URLs, or other data as SVG graphics. RadzenQRCode supports extensive customization including colors, shapes, error correction, and embedded logos. Encodes data in a two-dimensional barcode format scannable by smartphones and QR code readers. Generates QR codes entirely client-side as SVG, with no external dependencies. Features data encoding (text, URLs, contact info, WiFi credentials, or any string data), error correction levels (Low, Medium, Quartile, High) for different damage resistance, customization of colors for modules (dots) and background with custom shapes (Square, Rounded, Circle), optional logo/image embedding in the center of the QR code, eye styling to customize the appearance of the three corner finder patterns, and responsive size (percentage or pixel-based) for responsive layouts. Higher error correction levels allow the QR code to remain scannable even when partially damaged or obscured (e.g., by a logo). Use Quartile or High error correction when embedding logos.

Declaration
public RadzenQRCode()

Properties

Backgroundlink

Gets or sets the background color of the QR code. Should contrast well with the foreground color for reliable scanning.

Declaration
public string Background { get; set; }
Property Value
Type Description
stringGets or sets the background color of the QR code. Should contrast well with the foreground color for reliable scanning.

Ecclink

Gets or sets the error correction level determining how much damage the QR code can sustain while remaining scannable. Higher levels add more redundancy but reduce data capacity. Use High or Quartile when embedding logos.

Declaration
public RadzenQREcc Ecc { get; set; }
Property Value
Type Description
RadzenQREccGets or sets the error correction level determining how much damage the QR code can sustain while remaining scannable. Higher levels add more redundancy but reduce data capacity. Use High or Quartile when embedding logos.

EyeColorlink

Optional color for eyes; if empty, falls back to Foreground.

Declaration
public string EyeColor { get; set; }
Property Value
Type Description
stringOptional color for eyes; if empty, falls back to Foreground.

EyeColorBottomLeftlink

Optional color for bottom right eye; if empty, falls back to EyeColor.

Declaration
public string EyeColorBottomLeft { get; set; }
Property Value
Type Description
stringOptional color for bottom right eye; if empty, falls back to EyeColor.

EyeColorTopLeftlink

Optional color for top left eye; if empty, falls back to EyeColor.

Declaration
public string EyeColorTopLeft { get; set; }
Property Value
Type Description
stringOptional color for top left eye; if empty, falls back to EyeColor.

EyeColorTopRightlink

Optional color for top right eye; if empty, falls back to EyeColor.

Declaration
public string EyeColorTopRight { get; set; }
Property Value
Type Description
stringOptional color for top right eye; if empty, falls back to EyeColor.

EyeShapelink

Shape for finder eyes (the 3 corner boxes).

Declaration
public QRCodeEyeShape EyeShape { get; set; }
Property Value
Type Description
QRCodeEyeShapeShape for finder eyes (the 3 corner boxes).

EyeShapeBottomLeftlink

Shape for top bottom finder eye.

Declaration
public QRCodeEyeShape? EyeShapeBottomLeft { get; set; }
Property Value
Type Description
QRCodeEyeShape?Shape for top bottom finder eye.

EyeShapeTopLeftlink

Shape for top left finder eye.

Declaration
public QRCodeEyeShape? EyeShapeTopLeft { get; set; }
Property Value
Type Description
QRCodeEyeShape?Shape for top left finder eye.

EyeShapeTopRightlink

Shape for top right finder eye.

Declaration
public QRCodeEyeShape? EyeShapeTopRight { get; set; }
Property Value
Type Description
QRCodeEyeShape?Shape for top right finder eye.

Foregroundlink

Gets or sets the color of the QR code modules (the dark squares/dots). Supports any valid CSS color. Use high contrast with background for best scanability.

Declaration
public string Foreground { get; set; }
Property Value
Type Description
stringGets or sets the color of the QR code modules (the dark squares/dots). Supports any valid CSS color. Use high contrast with background for best scanability.

Imagelink

URL, data: URI, or raw base64 (will be prefixed) to render in the center.

Declaration
public string Image { get; set; }
Property Value
Type Description
stringURL, data: URI, or raw base64 (will be prefixed) to render in the center.

ImageBackgroundlink

Background color under the logo (usually white).

Declaration
public string ImageBackground { get; set; }
Property Value
Type Description
stringBackground color under the logo (usually white).

ImageBackgroundOpacitylink

Background opacity under the logo (0..1). Default 1.

Declaration
public double ImageBackgroundOpacity { get; set; }
Property Value
Type Description
doubleBackground opacity under the logo (0..1). Default 1.

ImageCornerRadiuslink

Rounded-corner radius for the logo cutout in module units. Default 0.75.

Declaration
public double ImageCornerRadius { get; set; }
Property Value
Type Description
doubleRounded-corner radius for the logo cutout in module units. Default 0.75.

ImagePaddingModuleslink

Extra white padding around the logo in module units. Default 1.

Declaration
public double ImagePaddingModules { get; set; }
Property Value
Type Description
doubleExtra white padding around the logo in module units. Default 1.

ImageSizePercentlink

Logo box size as % of the inner QR (without quiet zone). Safe range 5�60%. Default 20.

Declaration
public double ImageSizePercent { get; set; }
Property Value
Type Description
doubleLogo box size as % of the inner QR (without quiet zone). Safe range 5�60%. Default 20.

ModuleShapelink

Gets or sets the visual shape of the QR code modules (data squares). Square creates standard QR codes, Rounded creates softer corners, Circle creates dot-based codes.

Declaration
public QRCodeModuleShape ModuleShape { get; set; }
Property Value
Type Description
QRCodeModuleShapeGets or sets the visual shape of the QR code modules (data squares). Square creates standard QR codes, Rounded creates softer corners, Circle creates dot-based codes.

Sizelink

Gets or sets the rendered size (both width and height) of the QR code SVG. Accepts CSS units (e.g., "200px", "100%", "10rem"). Use percentage for responsive sizing.

Declaration
public string Size { get; set; }
Property Value
Type Description
stringGets or sets the rendered size (both width and height) of the QR code SVG. Accepts CSS units (e.g., "200px", "100%", "10rem"). Use percentage for responsive sizing.

Valuelink

Gets or sets the text or data to encode in the QR code. Can be plain text, URLs, contact information (vCard), WiFi credentials, or any string data.

Declaration
public string Value { get; set; }
Property Value
Type Description
stringGets or sets the text or data to encode in the QR code. Can be plain text, URLs, contact information (vCard), WiFi credentials, or any string data.

Methods

BuildRenderTreelink

Declaration
protected override void BuildRenderTree(Rendering.RenderTreeBuilder __builder)
Parameters
Type Name Description
Rendering.RenderTreeBuilder __builder

GetComponentCssClasslink

Gets the component CSS class.

Declaration
protected override string GetComponentCssClass()
Returns
Type Description
string

ToSvglink

Returns the SVG markup of the rendered QR code as a string.

Declaration
public Task<string> ToSvg()
Returns
Type Description
Task<string>A Task<T> representing the asynchronous operation. The task result contains the SVG markup of the QR code.
An error has occurred. This app may no longer respond until reloaded. Reload 🗙