Class RadzenBarcode
A 1D barcode generator component that renders barcodes as SVG graphics. Generates barcodes entirely client-side (no external dependencies).
Inherited Members
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
Syntax
public class RadzenBarcode : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
Examples
<RadzenBarcode Value="RADZEN-12345" Type="RadzenBarcodeType.Code128" Height="80px" />
Constructors
RadzenBarcode()
A 1D barcode generator component that renders barcodes as SVG graphics. Generates barcodes entirely client-side (no external dependencies).
Declaration
public RadzenBarcode()
Examples
<RadzenBarcode Value="RADZEN-12345" Type="RadzenBarcodeType.Code128" Height="80px" />
Properties
Background
Gets or sets the barcode background color.
Declaration
[Parameter]
public string Background { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
BarHeight
Gets or sets the height of the bars in SVG units (viewBox units). Default is 50.
Declaration
[Parameter]
public double BarHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
FontSize
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
[Parameter]
public double FontSize { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
Foreground
Gets or sets the barcode bars color.
Declaration
[Parameter]
public string Foreground { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Height
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
[Parameter]
public string Height { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
QuietZoneModules
Gets or sets the quiet zone in modules (left and right padding).
Declaration
[Parameter]
public int QuietZoneModules { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
ShowChecksum
Gets or sets whether to show the checksum (if applicable for the selected Type) under the bars.
Declaration
[Parameter]
public bool ShowChecksum { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
ShowValue
Gets or sets whether to show the value as text under the bars.
Declaration
[Parameter]
public bool ShowValue { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
TextMarginTop
Gets or sets the gap between bars and text in SVG units (viewBox units).
Declaration
[Parameter]
public double TextMarginTop { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
Type
Gets or sets the barcode type.
Declaration
[Parameter]
public RadzenBarcodeType Type { get; set; }
Property Value
| Type | Description |
|---|---|
| RadzenBarcodeType |
Value
Gets or sets the barcode value to encode.
Declaration
[Parameter]
public string Value { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ValueStyle
Gets or sets the value inline CSS style.
Declaration
[Parameter]
public virtual string? ValueStyle { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The value style. |
Width
Gets or sets the rendered width of the SVG. Accepts CSS units (e.g. "300px", "100%").
Declaration
[Parameter]
public string Width { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
BuildRenderTree(RenderTreeBuilder)
A 1D barcode generator component that renders barcodes as SVG graphics. Generates barcodes entirely client-side (no external dependencies).
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTreeBuilder | __builder |
Overrides
GetComponentCssClass()
Gets the component CSS class.
Declaration
protected override string GetComponentCssClass()
Returns
| Type | Description |
|---|---|
| string |
Overrides
HasChecksum(RadzenBarcodeType)
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 |
|---|---|
| bool |
|