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

@spectrum-web-components/avatar

v1.12.2

Published

An `<sp-avatar>` is a thumbnail representation of an entity, such as a user or an organization. Avatars can have a defined image, which is usually uploaded by a user.

Downloads

41,791

Readme

Overview

An <sp-avatar> is a thumbnail representation of an entity, such as a user or an organization. Avatars can have a defined image, which is usually uploaded by a user.

View the design documentation for this component.

Usage

See it on NPM! How big is this package in your project? Try it on Stackblitz

yarn add @spectrum-web-components/avatar

Import the side effectful registration of <sp-avatar> via:

import '@spectrum-web-components/avatar/sp-avatar.js';

When looking to leverage the Avatar base class as a type and/or for extension purposes, do so via:

import { Avatar } from '@spectrum-web-components/avatar';

Options

Sizes

Avatar sizes scale exponentially, based on the Spectrum type scale. These range from size-50 to size-700. An avatar can also be customized to fit appropriately for your context. The default size is size-100.

<sp-avatar
  size="50"
  label="Demo User"
  src="https://picsum.photos/500/500"
></sp-avatar>
<sp-avatar
  size="75"
  label="Demo User"
  src="https://picsum.photos/500/500"
></sp-avatar>
<sp-avatar
  size="100"
  label="Demo User"
  src="https://picsum.photos/500/500"
></sp-avatar>
<sp-avatar
  size="200"
  label="Demo User"
  src="https://picsum.photos/500/500"
></sp-avatar>
<sp-avatar
  size="300"
  label="Demo User"
  src="https://picsum.photos/500/500"
></sp-avatar>
<sp-avatar
  size="400"
  label="Demo User"
  src="https://picsum.photos/500/500"
></sp-avatar>
<sp-avatar
  size="500"
  label="Demo User"
  src="https://picsum.photos/500/500"
></sp-avatar>
<sp-avatar
  size="600"
  label="Demo User"
  src="https://picsum.photos/500/500"
></sp-avatar>
<sp-avatar
  size="700"
  label="Demo User"
  src="https://picsum.photos/500/500"
></sp-avatar>

States

Generic avatars

Use branded generic avatars when a user has not set their avatar image. These images are designed to be abstracted from all genders, locales, and cultures.

Disabled

An avatar in a disabled state shows that an avatar exists, but is not available or a user is not active in that circumstance. This can be used to maintain layout continuity and communicate that an avatar may become available or active later.

Accessibility

The <sp-avatar> component requires proper accessibility attributes to ensure screen readers can appropriately handle the avatar image.

Labeled avatars

The label attribute of the <sp-avatar> will be passed into the <img> element as the alt attribute for use in defining a textual representation of the image displayed. This is the recommended approach for avatars that convey meaningful information.

<sp-avatar label="John Doe" src="https://picsum.photos/500/500"></sp-avatar>

Decorative avatars

When an avatar is purely decorative and does not convey meaningful information, use the is-decorative attribute to mark it as decorative. This will hide the avatar from screen readers with alt="" and aria-hidden="true".

<sp-avatar is-decorative src="https://picsum.photos/500/500"></sp-avatar>

Linked avatars

When an avatar has an href attribute, it becomes a link and requires an accessible name. Provide a label attribute to give the link meaningful text for screen readers.

<sp-avatar
  label="View John Doe's profile"
  src="https://picsum.photos/500/500"
  href="https://adobe.com"
></sp-avatar>

Note: Decorative avatars should typically not be interactive links. If you need a decorative avatar with a link, you must provide a label attribute for accessibility compliance.