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

nextjs-notion-avatar

v1.1.6

Published

A Next.js-ready fork and update of react-notion-avatar, for avatar rendering in Next.js projects.

Readme

Next.js Notion Avatar (Fork & Update)

This project is a fork and update of the original react-notion-avatar (MIT, 2021) by zonemeen.

This fork and update is maintained by Joao Pedro Goncalves (GitHub), (MIT, 2025).


Components

This package provides two portable, ready-to-use avatar generator components:

  • NotionAvatarGenerator: The full-featured, customizable avatar generator (all avatar parts, color picker, random/save/cancel actions).
  • SimpleAvatarGenerator: A minimal version with only a color picker and action buttons (random/save/cancel), for quick use or embedding.

Getting Started (NPM Package)

Install the package:

npm install nextjs-notion-avatar
# or
yarn add nextjs-notion-avatar
# or
pnpm add nextjs-notion-avatar

Usage: NotionAvatarGenerator (Full)

import { NotionAvatarGenerator } from 'nextjs-notion-avatar';

<NotionAvatarGenerator
  onCancel={() => { /* handle cancel */ }}
  onRandom={(config, bgColor) => { /* handle random config */ }}
  onSave={(config, bgColor) => { /* handle save config */ }}
  actionButtonProps={{
    background: '#000',
    color: '#fff',
    borderRadius: '0.75rem',
    width: '180px',
    fontSize: '1.125rem',
    fontWeight: 600,
    padding: '0.5rem 1.5rem',
    className: 'transition-colors hover:bg-black/90',
  }}
  cancelLabel="Abort"
  randomLabel="Surprise Me"
  saveLabel="Confirm"
/>

Props (NotionAvatarGenerator)

  • onCancel: Optional function called when the Cancel button is pressed.
  • onRandom: Optional function called with the AvatarConfig object and background color when Generate Random is pressed.
  • onSave: Optional function called with the AvatarConfig object and background color when Save is pressed.
  • actionButtonProps: Optional object to override style/className for all action buttons (Cancel, Generate, Save). Supports:
    • className: string — extra class names for the button
    • style: React.CSSProperties — inline style object
    • background: string — background color (e.g. #000)
    • color: string — text color
    • width: string or number — button width
    • fontSize: string or number — font size
    • fontWeight: string or number — font weight
    • borderRadius: string or number — border radius
    • padding: string — padding (e.g. 0.5rem 1.5rem)
  • cancelLabel: Optional string to override the Cancel button label.
  • randomLabel: Optional string to override the Generate Random button label.
  • saveLabel: Optional string to override the Save button label.
  • avatarSize: Optional string to override the avatar size.

Usage: SimpleAvatarGenerator (Minimal)

import { SimpleAvatarGenerator } from 'nextjs-notion-avatar';

<SimpleAvatarGenerator
  onCancel={() => { /* handle cancel */ }}
  onRandom={(config, bgColor) => { /* handle random config */ }}
  onSave={(config, bgColor) => { /* handle save config */ }}
  actionButtonProps={{
    background: '#000',
    color: '#fff',
    borderRadius: '0.75rem',
    width: '180px',
    fontSize: '1.125rem',
    fontWeight: 600,
    padding: '0.5rem 1.5rem',
    className: 'transition-colors hover:bg-black/90',
  }}
  cancelLabel="Abort"
  randomLabel="Surprise Me"
  saveLabel="Confirm"
  avatarSize="200px"
/>

Props (SimpleAvatarGenerator)

  • onCancel: Optional function called when the Cancel button is pressed.
  • onRandom: Optional function called with the AvatarConfig object and background color when Generate is pressed.
  • onSave: Optional function called with the AvatarConfig object and background color when Save is pressed.
  • actionButtonProps: Optional object to override style/className for all action buttons (Cancel, Generate, Save). Same as above.
  • cancelLabel: Optional string to override the Cancel button label.
  • randomLabel: Optional string to override the Generate button label.
  • saveLabel: Optional string to override the Save button label.
  • avatarSize: Optional string to override the avatar size.

Differences Between Components

| Component | Avatar Parts | Color Picker | Action Buttons | Portability | Use Case | |--------------------------|--------------|--------------|---------------|-------------|-------------------------| | NotionAvatarGenerator | Yes | Yes | Yes | High | Full-featured editor | | SimpleAvatarGenerator | No | Yes | Yes | High | Minimal, quick preview |


Example: Custom Avatar Rendering

You can also use the base avatar renderer directly:

import NotionAvatar, { getRandomConfig } from 'nextjs-notion-avatar';

const config = getRandomConfig();

<NotionAvatar
  style={{ width: '6rem', height: '6rem' }}
  config={config}
  bgColor="#debaba"
  shape="square"
/>

Development & Demo

  • Run the Next.js app locally:
npm install
npm run dev
# or
yarn install && yarn dev
  • Visit http://localhost:3000 to use the full-featured editor and test both components.
  • The /templates page demonstrates both generators side by side.

About the Original Project

Assets


License

Released under MIT by @zonemeen and updated by Joao Pedro Goncalves.