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

@mntzdevs/label-generator

v1.0.0

Published

Label Generator library - React component library for creating and editing label templates.

Readme

@mntzdevs/label-generator

Label Generator library - React component library for creating and editing label templates.

Installation

npm install @mntzdevs/label-generator

That's it! All required dependencies (including Mantine) will be installed automatically.

Peer Dependencies

Only React and ReactDOM are peer dependencies (if you're using React in your project, you likely already have them):

  • react >= 18.0.0
  • react-dom >= 18.0.0

Note: Tailwind CSS is bundled with the library CSS, so you don't need to install it separately. However, if you're using Tailwind in your project, make sure it doesn't conflict.

Usage

Plain JavaScript

Important: Make sure you're using a bundler (like Vite, Webpack, or Parcel) that supports ES modules and package.json exports. If you're using a simple HTML file with <script type="module">, you may need to configure your dev server to properly resolve npm packages.

import { create } from '@mntzdevs/label-generator';
import '@mntzdevs/label-generator/label-generator.css';

const rootElement = document.getElementById('label-generator');
const api = create(rootElement);

// Set initial template
api.setState({
  canvas: {
    width: 100,
    height: 50,
    unit: 'mm',
    dpi: 300,
  },
  nodes: [],
  print: {
    format: 'sheet',
  },
});

// Get current state
const state = api.getState();

React

import { LabelGenerator } from '@mntzdevs/label-generator/react';
import '@mntzdevs/label-generator/label-generator.css';

function App() {
  const apiRef = useRef<LabelGeneratorApi>(null);

  useEffect(() => {
    if (apiRef.current) {
      apiRef.current.setState({
        canvas: {
          width: 100,
          height: 50,
          unit: 'mm',
          dpi: 300,
        },
        nodes: [],
        print: {
          format: 'sheet',
        },
      });
    }
  }, []);

  return <LabelGenerator ref={apiRef} />;
}

Important: CSS Import

You must import the CSS file for the library to work correctly:

import '@mntzdevs/label-generator/label-generator.css';

This CSS file includes:

  • Tailwind CSS utilities (all classes used by the library components)
  • Library-specific styles

Important: The CSS file is already processed and includes all Tailwind classes used by the library. You don't need to install or configure Tailwind CSS in your project.

API

create(selectorOrElement: string | HTMLElement): LabelGeneratorApi

Creates a new label generator instance.

Returns:

  • getState(): Template | null - Get current template state
  • setState(template: Template): void - Set template state

React Component

<LabelGenerator ref={apiRef} />

The component exposes the same API through a ref.

Examples

See the examples/ directory for complete examples:

  • examples/plain/ - Plain JavaScript example
  • examples/react/ - React example

Development

# Install dependencies
npm install

# Run development server
npm run dev

# Build library
npm run build:lib

Troubleshooting

Error: Cannot find module '@mntzdevs/label-generator/dist/index.js' or 'dist/index.js not found'

This error occurs when your bundler or browser tries to resolve the module incorrectly. Here are solutions:

  1. Make sure you're using the correct import:

    // ✅ Correct
    import { create } from '@mntzdevs/label-generator';
       
    // ❌ Wrong - don't import from dist directly
    import { create } from '@mntzdevs/label-generator/dist/index.js';
  2. If using Vite, ensure proper module resolution:

    • Vite should automatically resolve package.json exports
    • If you're using a custom Vite config, make sure you're not overriding module resolution
  3. If using a dev server that doesn't support package.json exports:

    • Use a bundler like Vite, Webpack, or Parcel
    • Or configure your dev server to properly resolve npm packages
  4. Build the library first (if using locally):

    cd path/to/label-generator
    npm run build:lib
  5. If using npm link, rebuild after changes:

    # In library directory
    npm run build:lib
       
    # In parent app, restart dev server

CSS not loading in plain JS

Make sure you import the CSS file:

import '@mntzdevs/label-generator/label-generator.css';

License

MIT