RadzenBarcode Class

A 1D barcode generator component that renders barcodes as SVG graphics. Generates barcodes entirely client-side (no external dependencies).

Inheritance

Object

ComponentBase

RadzenComponent

RadzenBarcode

Implements

IComponent

IHandleEvent

IHandleAfterRender

Namespace: Radzen.Blazor

Assembly: Radzen.Blazor.dll

Syntax

public class RadzenBarcode : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender

Examples

<RadzenBarcode Value="RADZEN-12345" Type="RadzenBarcodeType.Code128" Height="80px" />

Constructors

RadzenBarcodelink

A 1D barcode generator component that renders barcodes as SVG graphics. Generates barcodes entirely client-side (no external dependencies).

Declaration
public RadzenBarcode()

Properties

Backgroundlink

Gets or sets the barcode background color.

Declaration
public string Background { get; set; }
Property Value
Type Description
stringGets or sets the barcode background color.

BarHeightlink

Gets or sets the height of the bars in SVG units (viewBox units). Default is 50.

Declaration
public double BarHeight { get; set; }
Property Value
Type Description
doubleGets or sets the height of the bars in SVG units (viewBox units). Default is 50.

FontSizelink

Gets or sets the font size for layout calculations of the value text (in SVG viewBox units). This is not automatically applied as an SVG attribute; use ValueStyle to style the text.

Declaration
public double FontSize { get; set; }
Property Value
Type Description
doubleGets or sets the font size for layout calculations of the value text (in SVG viewBox units). This is not automatically applied as an SVG attribute; use ValueStyle to style the text.

Foregroundlink

Gets or sets the barcode bars color.

Declaration
public string Foreground { get; set; }
Property Value
Type Description
stringGets or sets the barcode bars color.

Heightlink

Gets or sets the rendered height of the SVG. Accepts CSS units (e.g. "80px"). If ShowValue is true, the text is drawn inside this height.

Declaration
public string Height { get; set; }
Property Value
Type Description
stringGets or sets the rendered height of the SVG. Accepts CSS units (e.g. "80px"). If ShowValue is true, the text is drawn inside this height.

QuietZoneModuleslink

Gets or sets the quiet zone in modules (left and right padding).

Declaration
public int QuietZoneModules { get; set; }
Property Value
Type Description
intGets or sets the quiet zone in modules (left and right padding).

ShowChecksumlink

Gets or sets whether to show the checksum (if applicable for the selected Type) under the bars.

Declaration
public bool ShowChecksum { get; set; }
Property Value
Type Description
boolGets or sets whether to show the checksum (if applicable for the selected Type) under the bars.

ShowValuelink

Gets or sets whether to show the value as text under the bars.

Declaration
public bool ShowValue { get; set; }
Property Value
Type Description
boolGets or sets whether to show the value as text under the bars.

TextMarginToplink

Gets or sets the gap between bars and text in SVG units (viewBox units).

Declaration
public double TextMarginTop { get; set; }
Property Value
Type Description
doubleGets or sets the gap between bars and text in SVG units (viewBox units).

Typelink

Gets or sets the barcode type.

Declaration
public RadzenBarcodeType Type { get; set; }
Property Value
Type Description
RadzenBarcodeTypeGets or sets the barcode type.

Valuelink

Gets or sets the barcode value to encode.

Declaration
public string Value { get; set; }
Property Value
Type Description
stringGets or sets the barcode value to encode.

ValueStylelink

Gets or sets the value inline CSS style.

Declaration
public string ValueStyle { get; set; }
Property Value
Type Description
stringGets or sets the value inline CSS style.

Widthlink

Gets or sets the rendered width of the SVG. Accepts CSS units (e.g. "300px", "100%").

Declaration
public string Width { get; set; }
Property Value
Type Description
stringGets or sets the rendered width of the SVG. Accepts CSS units (e.g. "300px", "100%").

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

HasChecksumlink

Gets whether the specified barcode type produces a checksum value that can be displayed when ShowChecksum is enabled.

Declaration
public static bool HasChecksum(RadzenBarcodeType type)
Parameters
Type Name Description
RadzenBarcodeType type The barcode type.
Returns
Type Description
booltrue if the type has a checksum value; otherwise, false.

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 🗙