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

@creaditor/user-menu

v1.0.3

Published

A flexible and modern user avatar component built with Lit that displays user information and provides a dropdown menu for user actions

Readme

User Menu Component

A flexible and modern user avatar component built with Lit that displays user information and provides a dropdown menu for user actions.

Features

  • Circle Avatar: Displays user avatar image, initials, or default icon
  • Smart Fallbacks: Automatically shows initials if no avatar is provided
  • Customizable Text: Configurable logout text for internationalization
  • Interactive Menu: Click to open dropdown menu with smooth animations
  • Responsive Design: Works seamlessly across different screen sizes
  • Accessibility: Proper ARIA attributes and keyboard navigation support

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | username | String | "" | User's display name (used for initials if no avatar) | | avatarUrl | String | "" | URL to user's profile image | | onLogout | Function | () => {} | Callback function called when logout is clicked | | logoutText | String | "Logout" | Customizable text for the logout button |

Usage

Basic Usage

<cdtr-user-menu 
  username="John Doe" 
  on-logout=${() => console.log('User logged out')}
></cdtr-user-menu>

With Avatar Image

<cdtr-user-menu 
  username="Jane Smith" 
  avatar-url="https://example.com/avatar.jpg"
  logout-text="Sign Out"
  on-logout=${() => handleLogout()}
></cdtr-user-menu>

Custom Logout Text

<cdtr-user-menu 
  username="María García" 
  logout-text="Cerrar Sesión"
  on-logout=${() => cerrarSesion()}
></cdtr-user-menu>

Default State (No Username/Avatar)

<cdtr-user-menu 
  logout-text="Logout"
  on-logout=${() => handleLogout()}
></cdtr-user-menu>

Avatar Display Logic

The component automatically determines what to display based on the provided props:

  1. Avatar Image: If avatarUrl is provided, displays the image
  2. Initials: If no avatarUrl but username is provided, shows first two letters
  3. Default Icon: If neither is provided, shows a generic user icon

Styling

The component uses CSS custom properties for theming:

:root {
  --primary: #6366f1;        /* Primary color for avatar background */
  --primary-dark: #4f46e5;   /* Darker shade for gradients */
}

Events

  • Click on avatar: Opens/closes the dropdown menu
  • Click on logout: Triggers the onLogout callback and closes the menu
  • Click outside: Automatically closes the menu

Browser Support

  • Modern browsers with ES6+ support
  • Requires Shadow DOM support
  • Compatible with Lit 3.x

Development

# Install dependencies
npm install

# Start development server
npm run dev

# Build for production
npm run build

License

MIT