# Blazor Barcode Overview

The <a href="https://www.telerik.com/blazor-ui/barcode" target="_blank">Blazor Barcode component</a> represents data in a machine-readable format. It supports several different encoding standards.

All graphics are rendered on the client by using [Scalable Vector Graphics (SVG)](https://www.w3.org/Graphics/SVG/).

## Creating Blazor Barcode

1. Add the `TelerikBarcode` tag to add the component to your razor page.

2. Set the `Value` property.

3. Set the `Height` and `Width` properties.

4. Optionally, choose a `Type` (one of the [encodings we support](https://www.telerik.com/blazor-ui/documentation/components/barcodes/barcode/encoding)).
   * Its default encoding is `Code39`.

> caption A basic configuration of the Telerik Barcode

<demo metaUrl="client/barcode/basic-configuration/" height="420"></demo>

## Encoding

Encoding represents the mapping between messages and barcodes. [Read more about the supported Blazor Barcode Encodings](https://www.telerik.com/blazor-ui/documentation/components/barcodes/barcode/encoding).

## Methods

The Barcode methods are accessible through it's reference.

* `Refresh` - redraws the component.

> caption Get a reference to the Barcode and use its methods

<demo metaUrl="client/barcode/methods/" height="460"></demo>

## Parameters

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

| Parameter    | Type                               | Description                                                                                                                                                                        |
| ------------ | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `RenderAs`   | `RenderingMode` enum <br /> `Svg`  | Defines the preferred rendering mode - svg/canvas.                                                                                                                                 |
| `Checksum`   | `bool`                             | By setting it to true, the Barcode will display the checksum digit next to the value in the text area.                                                                             |
| `Type`       | `BarcodeType` enum <br /> `Code39` | Defines the symbology (encoding) the Barcode will use - ([full list of supported encodings](https://www.telerik.com/blazor-ui/documentation/components/barcodes/barcode/encoding)) |
| `Value`      | `string`                           | Defines the initial value of the Barcode.                                                                                                                                          |
| `Width`      | `string`                           |                                                                                                                                                                                    |
| `Height`     | `string`                           |                                                                                                                                                                                    |
| `Class`      | `string`                           | The CSS class that will be rendered on the main wrapping element of the Barcode component.                                                                                         |
| `Background` | `string`                           |                                                                                                                                                                                    |
| `Color`      | `string`                           | Defines the color of the bar elements.                                                                                                                                             |

### BarcodeText parameters

The nested `BarcodeText` tag exposes parameters that customize the appearance of the Blazor Barcode text:

| Parameter                  | Type                 | Description                                                                         |
| -------------------------- | -------------------- | ----------------------------------------------------------------------------------- |
| `Color`                    | `string`             |                                                                                     |
| `Font`                     | `string`             |                                                                                     |
| `BarcodeTextMargin`        | `object`             |                                                                                     |
| `BarcodeTextMargin.Bottom` | `double`             |                                                                                     |
| `BarcodeTextMargin.Left`   | `double`             |                                                                                     |
| `BarcodeTextMargin.Right`  | `double`             |                                                                                     |
| `BarcodeTextMargin.Top`    | `double`             |                                                                                     |
| `Visible`                  | `bool` <br /> `true` | If `false`, the Barcode will not display the value as text below the barcode lines. |

### BarcodeBorder parameters

The nested `BarcodeBorder` tag exposes parameters that enable you to customize the appearance of the Blazor Barcode border:

| Parameter  | Type                           | Description |
| ---------- | ------------------------------ | ----------- |
| `Color`    | `string`                       |             |
| `DashType` | `DashType` enum <br /> `Solid` |             |
| `Width`    | `double`                       |             |

### BarcodePadding parameters

The nested `BarcodePadding` tag exposes parameters that enable you to customize the appearance of the Blazor Barcode:

| Parameter | Type     | Description |
| --------- | -------- | ----------- |
| `Bottom`  | `double` |             |
| `Left`    | `double` |             |
| `Right`   | `double` |             |
| `Top`     | `double` |             |

## Next Steps

[Explore the Barcode Encodings](https://www.telerik.com/blazor-ui/documentation/components/barcodes/barcode/encoding)

## See Also

* [Live Demo: Barcode](https://demos.telerik.com/blazor-ui/barcode/overview)
* [Live Demo: Barcode Encoding](https://demos.telerik.com/blazor-ui/barcode/encodings)
* [Export Barcode to Image](https://www.telerik.com/blazor-ui/documentation/knowledge-base/qrcode-barcode-chart-export-to-image)
