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

morphbadges

v0.1.0

Published

A dynamic, state-based badge that smoothly morphs between states in real time — label, color, width and icon tween as your data changes.

Downloads

123

Readme

morphbadges

A dynamic, state-based badge that smoothly morphs between states in real time. One element — its label, color, width and icon all tween as your data changes (free → paid, member → admin, pending → success).

Animation is powered by Motion — the shape morph is a real layout (FLIP) animation, so the pill glides between sizes instead of snapping. The label/icon swaps and accent recolor ride along with it.

npm install morphbadges

react, react-dom and motion are the runtime dependencies (motion is installed automatically).

Usage

import { Morphbadges } from "morphbadges";
import "morphbadges/styles.css";

function Plan({ tier }: { tier: "free" | "pro" | "enterprise" }) {
  return (
    <Morphbadges
      state={tier}
      states={{
        free: { label: "Free", variant: "neutral" },
        pro: { label: "Pro", variant: "info" },
        enterprise: { label: "Enterprise", variant: "premium" },
      }}
    />
  );
}

Change the state prop and the badge morphs — old label exits up with blur, the new one enters from below, the pill recolors, and its width tweens to fit.

Static badge

<Morphbadges variant="success">Active</Morphbadges>

Props

| Prop | Type | Description | | ---------- | ------------------------------- | ------------------------------------------------------ | | states | Record<string, MorphState> | Map of state-key → descriptor. Enables morphing. | | state | string | Active key into states. Change it to morph. | | children | ReactNode | Static label when states is omitted. | | variant | neutral \| success \| info \| warning \| danger \| purple \| premium | Built-in semantic color. | | color | string | Custom accent (any CSS color). Overrides variant. | | icon | ReactNode | Leading icon; cross-fades on change. | | dot | boolean | Leading status dot (default: on when there's no icon). | | pulse | boolean | Pulse the dot — good for "live" states. | | solid | boolean | Fill the pill with the accent. | | size | sm \| md \| lg | Default md. | | duration | number | Total morph duration in ms (shape + color). Default 440. |

MorphState

interface MorphState {
  label: string;
  variant?: MorphVariant;
  color?: string;
  icon?: ReactNode;
  dot?: boolean;
  pulse?: boolean;
  solid?: boolean;
}

Accessibility

The badge is a role="status" live region and ships a prefers-reduced-motion guard — colors and labels still update, they just don't tween.

License

MIT