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

svghub

v0.1.4

Published

Cross-framework SVG icon library — one source of truth, native rendering for web (Custom Element), React Native, LynxJS, and VS Code.

Readme

A tiny, framework-agnostic SVG icon library. One source of truth for your icon set: a typed JavaScript registry, standalone SVG files, and a native web component — with a build pipeline ready for React Native, LynxJS, and VS Code.

npm i svghub

✨ Why Svghub?

Most icon libraries force you to choose between a giant React-only package, hand-copied SVGs, or a runtime that downloads icons over the network. Svghub takes a different approach:

  • Framework-agnostic core — icons live as plain data (name, viewBox, paths) in src/core/icons.gen.ts.
  • Native web component — drop in <svghub-icon name="github"> anywhere HTML runs. No framework needed.
  • Typed APIIconName, IconData, and getIcon() are fully typed out of the box.
  • Standalone SVGs — every icon is also published under svg/<name>.svg for design tools or static sites.
  • Build-once pipeline — add an SVG to icons/<category>/ and bun run build regenerates everything.

📦 Installation

# npm
npm i svghub

# yarn
yarn add svghub

# pnpm
pnpm add svghub

# bun
bun add svghub

🚀 Quick Start

Web Component (no framework)

Import the component once to register <svghub-icon>:

import 'svghub/web';

Then use it anywhere in your HTML or JSX:

<svghub-icon name="github" size="32" color="#C49A6C" stroke-width="1.5"></svghub-icon>

JavaScript / TypeScript API

import { icons, getIcon, type IconName, type IconData } from 'svghub';

const github = getIcon('github');
// {
//   name: 'github',
//   category: 'social',
//   viewBox: '0 0 24 24',
//   paths: [ ... ]
// }

const names: IconName[] = Object.keys(icons) as IconName[];

Static SVG files

<img src="node_modules/svghub/svg/github.svg" alt="GitHub" width="24" />

🧩 Web Component API

The <svghub-icon> custom element is registered automatically when you import svghub/web.

| Attribute | Default | Description | | -------------- | -------------- | ------------------------------------------------------------- | | name | — | Icon identifier (e.g. github, x, instagram). | | size | 24 | Width and height of the rendered SVG. | | color | currentColor | Stroke or fill color. | | stroke-width | 2 | Stroke width for outline icons. |

Manual registration

If you need a different tag name, import the element class and register it yourself:

import { SvghubIconElement, register } from 'svghub/web';

register('my-icon'); // now use <my-icon name="github">

🎨 Framework examples

React

import 'svghub/web';

export const SocialLinks = () => (
  <a href="https://github.com/bastndev/svghub">
    <svghub-icon name="github" size="24" />
  </a>
);

Vue

<script setup>
import 'svghub/web';
</script>

<template>
  <svghub-icon name="github" size="24" />
</template>

Svelte

<script>
  import 'svghub/web';
</script>

<svghub-icon name="github" size="24" />

Vanilla JS

<!doctype html>
<html>
  <head>
    <script type="module">
      import 'svghub/web';
    </script>
  </head>
  <body>
    <svghub-icon name="github"></svghub-icon>
  </body>
</html>

🗂️ Available icons

All icons are grouped by category. The current set lives under icons/social/ and icons/bottom-bar/:

| Icon | Name | Category | | --------------- | ------------------- | ---------- | | Facebook | facebook | social | | GitHub | github | social | | Instagram | instagram | social | | LinkedIn | linkedin | social | | TikTok | tiktok | social | | X (Twitter) | x | social | | YouTube | youtube | social | | - | - | - | | Home outline | home-outline | bottom-bar | | Home solid | home-solid | bottom-bar | | Message outline | message-outline | bottom-bar | | Message solid | message-solid | bottom-bar | | Plus | plus | bottom-bar | | User outline | user-outline | bottom-bar | | User solid | user-solid | bottom-bar | | Wallet outline | wallet-outline | bottom-bar | | Wallet solid | wallet-solid | bottom-bar |

New categories are created automatically by adding a subfolder under icons/.

🛠️ Development

Scripts

# Generate icon data from icons/ into src/core/icons.gen.ts and svg/
bun run build:icons

# Full build: icons + TypeScript bundles (ESM + CJS + types)
bun run build

# Clean generated files
bun run clean

# Run smoke tests
bun run test

Project structure

svghub/
├── icons/                  # Source of truth — add .svg files here
│   └── social/
│       ├── github.svg
│       └── ...
├── src/
│   ├── core/
│   │   ├── types.ts        # IconData interface
│   │   ├── icons.gen.ts    # Generated icon registry
│   │   └── index.ts        # Core API: getIcon, icons, types
│   └── web/
│       ├── icon-element.ts # <svghub-icon> custom element
│       └── index.ts        # Web entry + auto-registration
├── svg/                    # Generated standalone SVG files
├── scripts/
│   └── build-icons.ts      # Icon generator
└── test/
    └── smoke.mjs           # ESM/CJS smoke tests

Adding a new icon

  1. Drop an SVG into icons/<category>/<name>.svg.
  2. Make sure it has a viewBox attribute.
  3. Run bun run build.
  4. Verify the output in src/core/icons.gen.ts and svg/.

The generator reads viewBox, <path d="...">, and root-level fill mode. Outline presentation is normalized, while fill="currentColor" and an optional fill-rule="evenodd" preserve solid icons.

See icons/icons.md for the full contributor guide.

📤 Publishing

bun run build
npm version <patch|minor|major>
npm publish

prepublishOnly runs the full build automatically.

🧪 Testing

Svghub ships with a small smoke test suite that verifies:

  • The icon registry is non-empty.
  • Specific icons are present.
  • Dead canvas-bounds paths are stripped.
  • Both ESM and CJS builds expose the same API.
bun run test

📄 License

MIT © Gohit X — see LICENSE for details.