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

svg-barcode-generator

v1.0.0

Published

Lightweight SVG barcode generator for browsers, mobile, and modern JS runtimes

Readme

🦓 SVG Barcode Generator

Simple one-dimensional barcode generator focused on scalability and themability.
Created to be easy to use, lightweight, and compatible with Tailwind CSS.

Supported formats

| Type key | Standard | Use case | |---|---|---| | upc_a | UPC-A | Retail (North America) | | upc_e | UPC-E | Retail, compact packaging | | ean_13 | EAN-13 | Retail (worldwide) | | ean_8 | EAN-8 | Retail, small packaging | | code_128 | Code 128 | Logistics, shipping | | gs1_128 | GS1-128 | Supply chain, logistics (Code 128 + FNC1) | | code_93 | Code 93 | Industrial, inventory | | code_39 | Code 39 | Industrial, automotive, military | | itf | ITF (Interleaved 2 of 5) | Warehouse, distribution | | itf_14 | ITF-14 | Cartons, pallets (GS1 shipping containers) | | codabar | Codabar | Libraries, blood banks, FedEx | | msi | MSI Plessey | Retail shelf labels, inventory | | pharmacode | Pharmacode | Pharmaceutical packaging |

Why use this library

  • Creates responsive SVG graphics that adapt to parent container sizes.
  • TypeScript support - includes type definitions out of the box.
  • TailwindCSS friendly - no hardcoded colors, so fill-* and text-* classes cascade freely.
  • Can be used in the browser (ES2020) and in runtimes such as Node.js, Deno, and Bun.
  • Works in frameworks like React, Vue, Svelte, etc.
  • Compatible with React Native / Expo, and should work with NativeWind and Unistyles.
  • Dependency-free.
  • Tree-shakeable.

Usage

Basic

import SvgBarcodeGenerator from "svg-barcode-generator";

const svg = SvgBarcodeGenerator.generate("7423522549551", "ean_13");

console.log(svg); // <svg ...>...</svg>

React + Tailwind CSS

Since the generated SVG has no hardcoded colors, bars inherit the fill CSS property and the background is transparent. You can apply any color using standard CSS or Tailwind classes.

import SvgBarcodeGenerator from "svg-barcode-generator";

export const Barcode = () => {
  const svg = SvgBarcodeGenerator.generate("7423522549551", "ean_13");
  return (
    // Classic: Black bars on white background (safest for physical scanners)
    <div className="bg-white fill-black p-6">
      <div dangerouslySetInnerHTML={{ __html: svg }} />
    </div>
  );
};

Notes on specific formats

  • upc_a - alias for ean_13. UPC-A (12 digits) is a subset of EAN-13 (13 digits with a leading 0).
  • gs1_128 - Code 128 with an FNC1 character automatically injected at position 1. Physical scanners will prefix decoded output with ]C1 (AIM Symbology Identifier). Software decoders (e.g. ZXing) typically return raw data without this prefix.
  • itf_14 - Accepts 13 digits (check digit auto-calculated via Mod 10) or 14 digits directly.
  • pharmacode - Accepts numeric values from 3 to 131070.

Materials

License

This project is licensed under the MIT License.