npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@urenatech/zpl-react

v2.0.1

Published

ZPL-native barcode and label image components for React, powered by ZPL.AI.

Readme

@urenatech/zpl-react

Render barcodes and ZPL labels as PNG images from the ZPL.AI API in React.

import { Barcode } from "@urenatech/zpl-react";

<Barcode apiKey="zpk_xxxxx" type="code128" value="ORDER-10452" />

Install

npm install @urenatech/zpl-react

React 18 and 19 are supported. The package is marked "use client" for Next.js App Router; React is a peer dependency.

@urenatech/zpl-core is installed as a runtime dependency and provides shared barcode types, API requests, retry handling, errors, and PNG cropping.

API compatibility

This client follows the ZPL.AI v1 API reference and sends requests to https://app.zpl.ai/api. Deployments using this package require the documented public endpoints on app.zpl.ai and CORS access from your application's origin.

Create an API key in ZPL.ai settings. The API documents the zpk_... prefix. Browser keys are visible to users: never put a secret key in React code or a public environment variable. Both components send Authorization: Bearer <key> with each request.

Barcode

<Barcode apiKey="zpk_xxxxx" type="qr" value="https://zpl.ai" />

| Property | Type | Meaning | | --- | --- | --- | | apiKey | string | API key sent as a Bearer token. | | type | BarcodeType | API-supported barcode discriminator. | | value | string | Barcode data sent unchanged as data. |

All three properties are required. Barcode calls POST /public/barcode/img with { type, data: value } and uses the API's default render settings. The API performs symbology-specific validation; errors are displayed using its message field. The original PNG is displayed without cropping: free-tier responses can contain a black footer and randomized whitespace, which must not be removed. Barcode responses are requested with cache: "no-store" and are not cached by the library.

Supported types match the API's discriminator values:

| Linear | Matrix and stacked | | --- | --- | | code128, upca, upce, upc-extension, ean13, ean8, interleaved2of5, industrial2of5, code11, msi, code39, logmars, codabar, code93 | data-matrix, pdf417, aztec, maxicode, qr |

See barcode examples for each type. SUPPORTED_BARCODE_TYPES, isBarcodeType, and BarcodeType are re-exported from @urenatech/zpl-core for dynamic inputs. Types outside the public barcode API can be rendered from trusted ZPL through ZplLabel, if supported by the ZPL renderer.

ZplLabel

import { ZplLabel } from "@urenatech/zpl-react";

const zpl = `^XA
^PW812
^LL406
^FO40,30^A0N,36,36^FDOrder 10452^FS
^XZ`;

<ZplLabel apiKey="zpk_xxxxx" zpl={zpl} alt="Order 10452 label" />

ZplLabel calls POST /public/zpl/img with the ZPL and required render settings: widthIn: 4, heightIn: 2, dpmm: 8, backgroundColor: "#FFFFFF", and empty parameters. alt defaults to "ZPL label". ZPL input is sent unchanged; use trusted or sanitized ZPL. The returned label PNG is cropped to its non-white content in the browser. Preserve quiet zones in the ZPL itself if scanners need them.

Framework examples

Next.js client component:

"use client";
import { Barcode } from "@urenatech/zpl-react";

export function OrderBarcode({ value }: { value: string }) {
  return <Barcode apiKey={process.env.NEXT_PUBLIC_ZPL_AI_KEY!} type="code128" value={value} />;
}

Vite:

import { Barcode, ZplLabel } from "@urenatech/zpl-react";

export function Labels() {
  const apiKey = import.meta.env.VITE_ZPL_AI_KEY;
  return <>
    <Barcode apiKey={apiKey} type="data-matrix" value="ITEM-1001" />
    <ZplLabel apiKey={apiKey} zpl="^XA^FO20,20^FDHello^FS^XZ" />
  </>;
}

Public environment variables organize keys but do not hide them.

Runtime

Prop changes request a new image; stale requests are aborted. HTTP 429 is retried up to ten times, respecting Retry-After and staggering concurrent retries; 500, 502, 503, and 504 are retried up to twice. Loading uses aria-label="Generating label"; errors use role="alert". Object URLs are revoked on unmount or prop changes.

Development

From the repository root:

npm ci
npm run check
npm pack --workspace @urenatech/zpl-react --dry-run

The package builds ESM, CommonJS, and TypeScript declarations. The repository's examples/react directory uses this local package.

License

MIT License. Copyright © 2026 UrenaTech LLC. See LICENSE.