Docs › Start
npm
Installing @82label/core, imports, bundlers and TypeScript.
npm i @82label/coreOne ES module with no dependencies. TypeScript types ship with it (Template, Row, PrintOptions, PrintResult and more).
import { print } from '@82label/core';
import template from './labels/product.json'; // template JSON from the designer
async function printLabels(orders) {
const rows = orders.map((o) => ({ name: o.productName, price: o.priceText, sku: o.sku }));
const result = await print(template, rows);
// result.via: 'agent' (print agent) or 'browser'
return result;
}Keeping templates as files
Put the file from the designer's Download JSON in your project and import it. The template is versioned with your code and works without the 82label server.
import type { Template } from '@82label/core';
import raw from './labels/product.json';
const template = raw as Template;With the web component
import { defineLabelElement } from '@82label/core';
import '@82label/core/styles.css';
defineLabelElement(); // registers <label-82>Rendering on a server
renderToSVG builds an SVG string without a DOM: label previews in Node or Cloudflare Workers, or in email. Printing (print) runs in the browser only.
import { renderToSVG } from '@82label/core';
const svg = renderToSVG(template, { name: 'Wireless earbuds Pro', price: '₩39,000', sku: 'EP-2026-0412' });