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

@morphatar/react

v0.2.0

Published

React wrapper for Morphatar — deterministic algorithmic avatars.

Readme

@morphatar/react

React component for Morphatar — deterministic, zero-dependency algorithmic avatars.

One seed in, the same avatar out, on the server and in the browser.

Install

npm install @morphatar/react
# or
pnpm add @morphatar/react
# or
yarn add @morphatar/react

Requires React 17 or newer. @morphatar/core is installed automatically.

Usage

import { Morphatar } from '@morphatar/react';

export function UserBadge({ user }: { user: { id: string; name: string } }) {
  return <Morphatar seed={user.id} size={40} title={`${user.name}'s avatar`} />;
}

Variants

<Morphatar seed="ada" variant="organic" />    {/* blob with eyes (default) */}
<Morphatar seed="ada" variant="geometric" />  {/* Bauhaus grid */}
<Morphatar seed="ada" variant="pixel" />      {/* mirrored identicon */}

Styling

The component renders a <span> wrapping the <svg>. Any <span> attribute — className, style, onClick, data-*, aria-* — is forwarded to it.

<Morphatar seed="ada" size={64} className="rounded-full ring-2 ring-white" />
  • size={64} → a 64 × 64 px box.
  • size="3rem" → any CSS length; the box stays square via aspect-ratio.
  • Omit size → fills the parent's width, square.

Custom palette and background

<Morphatar
  seed="ada"
  variant="geometric"
  multicolor
  colors={['#e4572e', '#1789bb', 'rgb(27, 27, 27)']}
  background="#f4efe4"
/>

Animation

<Morphatar seed="ada" animation="blink" />  {/* also: 'dart' */}

Animations turn themselves off for users with prefers-reduced-motion.

Props

All options from @morphatar/core, plus standard <span> attributes.

| Prop | Type | Default | Description | | --- | --- | --- | --- | | seed | string | — (required) | Deterministic seed, e.g. a user id or email. | | variant | 'organic' \| 'geometric' \| 'pixel' | 'organic' | Shape algorithm. | | colors | string[] | derived from seed | Shape colours (hex, rgb(), hsl()). | | background | string | per variant | Background fill; 'transparent' paints nothing. Organic is transparent by default, geometric and pixel paint one. | | mask | 'circle' \| 'squircle' \| 'hexagon' \| 'none' | 'squircle' | Clip silhouette. | | complexity | number (1–10) | 5 | Node count / density. | | multicolor | boolean | false | Use the whole palette instead of one colour. | | animation | 'none' \| 'blink' \| 'dart' | 'none' | Idle eye motion. organic only — the grids have no eyes. | | size | number \| string | '100%' | px number or CSS length. | | title | string | 'Avatar' | Accessible name. The seed is never written into the markup. |

See the @morphatar/core README for how background, contrast and colour modes interact.

Server components and SSR

The component is marked 'use client' (it memoises with useMemo), so in the Next.js App Router you can import it from a Server Component and it is server-rendered as usual. Output is identical on server and client, so there is no hydration mismatch.

To render with zero client JavaScript, use the core functions directly — they are re-exported from this package:

// A Server Component
import { morphatarDataUri } from '@morphatar/react';

export default function Avatar({ id }: { id: string }) {
  return <img src={morphatarDataUri({ seed: id, size: 40 })} alt="" width={40} height={40} />;
}

Re-exports: morphatar, morphatarDataUri, morphatarPalette, and the Variant, Mask, Animation types.

License

MIT