# BarcodeApi (@salmonui/charts/barcode)

> The BarcodeApi interface of @salmonui/charts/barcode: Instance reached through ref on Barcode and QRCode.

Canonical: https://salmonui.dev/docs/reference/charts/barcode/BarcodeApi

```ts
import type { BarcodeApi } from '@salmonui/charts/barcode';
```

Also exported from `@salmonui/charts/barcode/pdf417`, `@salmonui/charts/barcode/gs1-databar`, `@salmonui/charts/barcode/dotcode`.

Entry index: https://salmonui.dev/docs/reference/charts/barcode (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/charts/barcode.md).

## Reference

Kind: interface

```ts
interface BarcodeApi {
    readonly element: SVGSVGElement | null;
    toSVGString(): string;
    toBlob(format?: BarcodeImageFormat, options?: Omit<BarcodeExportOptions, 'format' | 'fileName'>): Promise<Blob>;
    toDataURL(format?: BarcodeImageFormat, options?: Omit<BarcodeExportOptions, 'format' | 'fileName'>): Promise<string>;
    export(options?: BarcodeExportOptions): Promise<void>;
}
```

Instance reached through `ref` on `Barcode` and `QRCode`.

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `element` | `readonly element: SVGSVGElement \| null;` |  | The root `<svg>` (null before mount). |
| `toSVGString` | `toSVGString(): string;` |  | Standalone SVG markup; works without a DOM (server, tests). |
| `toBlob` | `toBlob(format?: BarcodeImageFormat, options?: Omit<BarcodeExportOptions, 'format' \| 'fileName'>): Promise<Blob>;` |  |  |
| `toDataURL` | `toDataURL(format?: BarcodeImageFormat, options?: Omit<BarcodeExportOptions, 'format' \| 'fileName'>): Promise<string>;` |  |  |
| `export` | `export(options?: BarcodeExportOptions): Promise<void>;` |  | Downloads the symbol; settles after the download started. |
