Skip to content
Storybook

Avatar

Represents a person or team with initials, an icon or a photo. Optional online status.

Preview

React · live from the Storybook

HTML and CSS

The same component as plain HTML with pixels-ui.css, no framework needed.

OR PB LSLana Steinerlana@pixels.io

Usage

  • Initials use the first letters of given and family name.
  • Arabic names: first letters of the first two words.

Installation

Included in the core files. No extra install.

HTML
<link rel="stylesheet" href="/css/pixels-tokens.css">
<link rel="stylesheet" href="/css/pixels-ui.css">
<script src="/js/pixels-ui.js" defer></script>

Examples

Sizes

XS 24 · SM 32 · MD 40 · LG 48 · XL 56 · 2XL 64.

OROROROROROR

Group

Overlapping avatars with an overflow count.

ORPBLS+2

API reference

Class / attributeTypeDescription
px-avatarclassInitials by default. Put an <img> inside for a photo.
px-avatar--xs … --2xlclassSize.
px-avatar--neutral · --accentclassType Icon / Accent.
px-avatar__status · --offlineclassStatus dot.
px-avatar-group · px-avatar-labelclassGroup and label group.

Figma properties

Avatar18 variants · page “Avatar”Open

Represents a person or team. Initials use the first letters of given and family name (Arabic names: first letters of the first two words). Swap in a photo via an image fill on the instance. Status dot…

PropertyTypeValues
InitialsText“OR”
StatusBoolean—
SizeVariantXS SM MD LG XL 2XL
TypeVariantInitials Icon Accent
Avatar group4 variants · page “Avatar”Open

Overlapping avatars with an overflow count. Earlier avatars sit on top. In RTL the stack starts on the right.

PropertyTypeValues
SizeVariantSM MD
DirectionVariantLTR RTL
Avatar label group6 variants · page “Avatar”Open

Avatar with name and supporting text (email, role). Used in tables, menus and headers.

PropertyTypeValues
NameText“Olivia Rhye”
Supporting textText“olivia@pixels.io”
SizeVariantSM MD LG
DirectionVariantLTR RTL

Design tokens

Component tokens from the Figma Component collection. Override them to restyle just this component.

TokenAliasLight value
--px-avatar-size-xs24px24px
--px-avatar-size-sm32px32px
--px-avatar-size-md40px40px
--px-avatar-size-lg48px48px
--px-avatar-size-xl56px56px
--px-avatar-size-2xl64px64px
--px-avatar-radiusradius-full999px
--px-avatar-background-neutralcolor-background-neutral-default#f2f4f7
--px-avatar-content-neutralcolor-content-neutral-secondary#475467
--px-avatar-ringcolor-surface-default#ffffff

Accessibility

  • Photos need alt text with the name; decorative initials next to a name can be aria-hidden.