A 1D barcode generator component that renders barcodes as SVG graphics. Generates barcodes entirely client-side (no external dependencies).
IComponent
IHandleEvent
IHandleAfterRender
RadzenComponent.SetParametersAsync
RadzenComponent.OnAfterRenderAsync
RadzenComponent.RaiseContextMenu
RadzenComponent.RaiseMouseEnter
RadzenComponent.AddContextMenu
RadzenComponent.RaiseMouseLeave
RadzenComponent.OnBecameInvisible
RadzenComponent.DefaultCulture
RadzenComponent.IsJSRuntimeAvailable
ComponentBase.OnInitializedAsync
ComponentBase.OnParametersSet
ComponentBase.OnParametersSetAsync
ComponentBase.StateHasChanged
ComponentBase.ShouldRender
ComponentBase.OnAfterRender
ComponentBase.InvokeAsync
ComponentBase.DispatchExceptionAsync
ComponentBase.RendererInfo
ComponentBase.Assets
ComponentBase.AssignedRenderMode
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
public class RadzenBarcode : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender<RadzenBarcode Value="RADZEN-12345" Type="RadzenBarcodeType.Code128" Height="80px" />A 1D barcode generator component that renders barcodes as SVG graphics. Generates barcodes entirely client-side (no external dependencies).
public RadzenBarcode()Gets or sets the barcode background color.
public string Background { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the barcode background color. |
Gets or sets the height of the bars in SVG units (viewBox units). Default is 50.
public double BarHeight { get; set; }
| Type | Description |
|---|---|
| double | Gets or sets the height of the bars in SVG units (viewBox units). Default is 50. |
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.
public double FontSize { get; set; }
| Type | Description |
|---|---|
| double | 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. |
Gets or sets the barcode bars color.
public string Foreground { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the barcode bars color. |
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.
public string Height { get; set; }
| Type | Description |
|---|---|
| string | 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. |
Gets or sets the quiet zone in modules (left and right padding).
public int QuietZoneModules { get; set; }
| Type | Description |
|---|---|
| int | Gets or sets the quiet zone in modules (left and right padding). |
Gets or sets whether to show the checksum (if applicable for the selected Type) under the bars.
public bool ShowChecksum { get; set; }
| Type | Description |
|---|---|
| bool | Gets or sets whether to show the checksum (if applicable for the selected Type) under the bars. |
Gets or sets whether to show the value as text under the bars.
public bool ShowValue { get; set; }
| Type | Description |
|---|---|
| bool | Gets or sets whether to show the value as text under the bars. |
Gets or sets the gap between bars and text in SVG units (viewBox units).
public double TextMarginTop { get; set; }
| Type | Description |
|---|---|
| double | Gets or sets the gap between bars and text in SVG units (viewBox units). |
Gets or sets the barcode type.
public RadzenBarcodeType Type { get; set; }
| Type | Description |
|---|---|
| RadzenBarcodeType | Gets or sets the barcode type. |
Gets or sets the barcode value to encode.
public string Value { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the barcode value to encode. |
Gets or sets the value inline CSS style.
public string ValueStyle { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the value inline CSS style. |
Gets or sets the rendered width of the SVG. Accepts CSS units (e.g. "300px", "100%").
public string Width { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the rendered width of the SVG. Accepts CSS units (e.g. "300px", "100%"). |
protected override void BuildRenderTree(Rendering.RenderTreeBuilder __builder)
| Type | Name | Description |
|---|---|---|
| Rendering.RenderTreeBuilder | __builder |
Gets the component CSS class.
protected override string GetComponentCssClass()
| Type | Description |
|---|---|
| string |
Gets whether the specified barcode type produces a checksum value that can be displayed when ShowChecksum is enabled.
public static bool HasChecksum(RadzenBarcodeType type)
| Type | Name | Description |
|---|---|---|
| RadzenBarcodeType | type | The barcode type. |
| Type | Description |
|---|---|
| bool | true if the type has a checksum value; otherwise, false. |
Returns the SVG markup of the rendered QR code as a string.
public Task<string> ToSvg()
| Type | Description |
|---|---|
| Task<string> | A Task<T> representing the asynchronous operation. The task result contains the SVG markup of the QR code. |