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

@mingcute/vanilla

v3.0.2

Published

Mingcute SVG strings and DOM helpers for vanilla JavaScript.

Readme


Overview

@mingcute/vanilla provides precompiled SVG strings together with helpers for serialization and browser DOM creation.

Use it for:

  • server-rendered markup;
  • static templates;
  • browser DOM insertion;
  • progressive enhancement; and
  • custom integrations that do not need a framework adapter.

Highlights

  • No framework runtime: suitable for browser, server, and edge environments.
  • Two rendering modes: SVG strings through toSvgString() and DOM elements through createIcon().
  • Tree-shakeable imports: style entry points and direct icon subpaths.
  • Validated attributes: names are checked and values are escaped.
  • Accessible options: titles, ARIA labels, and decorative behavior.
  • Shared geometry: generated assets come from @mingcute/icons.

Installation

# npm
npm install @mingcute/vanilla

# pnpm
pnpm add @mingcute/vanilla

# Yarn
yarn add @mingcute/vanilla

# Bun
bun add @mingcute/vanilla

Quick Start

import { createIcon, toSvgString } from '@mingcute/vanilla';
import { Home1Regular } from '@mingcute/vanilla/core-regular';

const markup = toSvgString(Home1Regular, {
  size: 24,
  color: 'currentColor',
  title: 'Home',
});

const element = createIcon(Home1Regular, {
  size: 24,
  className: 'navigation-icon',
  ariaHidden: true,
});

document.querySelector('nav')?.append(element);

toSvgString() works without a DOM. createIcon() requires document.

Imports

Style entry points

import {
  Home1Regular,
  Search2Regular,
} from '@mingcute/vanilla/core-regular';

Direct icon imports

import Home1Regular from '@mingcute/vanilla/core-regular/home-1';

Use direct icon paths in bundle-sensitive code.

API Reference

| Option | Type | Purpose | |---|---|---| | size | number \| string | Sets the default width and height | | width | number \| string | Overrides the rendered width | | height | number \| string | Overrides the rendered height | | color | string | Sets inherited SVG paint | | className | string | Adds an SVG class | | title | string | Creates an accessible <title> | | titleId | string | Overrides the title association ID | | ariaLabel | string | Supplies an accessible name | | ariaHidden | boolean-compatible value | Controls assistive-technology visibility | | attributes | attribute record | Adds validated SVG attributes |

Attribute names are validated and values are XML-escaped before serialization.

Rendering Modes

toSvgString()

Use this helper for server rendering, static generation, edge runtimes, or string-based templates:

const svg = toSvgString(Home1Regular, {
  size: 24,
  title: 'Home',
});

It does not read browser globals.

createIcon()

Use this helper to create a live SVGSVGElement:

const icon = createIcon(Home1Regular, {
  size: 24,
  ariaHidden: true,
});

document.body.append(icon);

It requires a DOM and throws a clear error when document is unavailable.

Accessibility

Meaningful icons

Provide one clear accessible name:

toSvgString(Home1Regular, {
  size: 24,
  title: 'Home',
});

Decorative icons

Hide icons when adjacent text already provides the label:

createIcon(Home1Regular, {
  size: 20,
  ariaHidden: true,
});

Icon-only controls

Put the accessible name on the control rather than duplicating it on the SVG.

Security

The package serializes generated Mingcute icon data and validates caller-provided attribute names.

It:

  • escapes XML attribute values;
  • rejects invalid attribute names;
  • scopes generated SVG resources; and
  • does not execute embedded script content.

The safety guarantee does not extend to arbitrary untrusted markup concatenated around the generated SVG string.

Available Styles

| Import subpath | Style | Icons | |---|---|---:| | core-regular | Core Regular | 1,663 | | core-filled | Core Filled | 1,663 | | Total | All public styles | 3,326 |

Production Guidance

  • The package is ESM-only and declares sideEffects: false.
  • Use toSvgString() in server and edge environments.
  • Call createIcon() only after a DOM is available.
  • Prefer direct icon subpaths in bundle-sensitive code.
  • Treat generated icon source as immutable.
  • Pass customization through documented options rather than modifying generated markup.
  • Keep one accessible name per meaningful icon.

Integration with Definitions

@mingcute/icons owns structured geometry, resources, names, and metadata.

@mingcute/vanilla owns:

  • SVG serialization options;
  • validated caller attributes;
  • accessible string output; and
  • browser DOM creation.

Troubleshooting

document is unavailable

Use toSvgString() during server rendering and call createIcon() only in a browser or DOM-compatible environment.

An attribute is rejected

Use a valid SVG/XML attribute name and pass it through attributes.

An icon is announced unexpectedly

Set ariaHidden: true for decorative icons or provide one clear accessible name for meaningful icons.

The bundle is larger than expected

Import icons from direct subpaths instead of importing complete styles as namespaces.

Development

This package is generated from canonical SVG sources. Do not edit generated output by hand.

pnpm --filter @mingcute/vanilla check

License

Licensed under the Apache License 2.0.

Links