Skip to main content
Urbicon UI

Avatar

User profile images with fallback initials and status indicators.

Playground

JD
Shape Style variant
Status Position Style variant
<Avatar
  name="Jane Doe"
  size="lg"
  status=""
/>

01 Examples

An Avatar shows the src photo, or the initials from name (the first letter of each word, up to two) when there is none. randomColor gives each name a stable colour, and children replace the initials with your own content.

Identity colours

randomColor hashes each name to a fixed hue from the identity palette, so people without a photo stay distinct and one person keeps the same colour everywhere.
AL
AT
GH
KJ
BL
ED
<Avatar name="Ada Lovelace" randomColor size="lg" />
<Avatar name="Alan Turing" randomColor size="lg" />
<Avatar name="Grace Hopper" randomColor size="lg" />
<Avatar name="Katherine Johnson" randomColor size="lg" />
<Avatar name="Barbara Liskov" randomColor size="lg" />
<Avatar name="Edsger Dijkstra" randomColor size="lg" />

Photo, with initials as the fallback

src renders the photo. If it is missing or fails to load, the avatar falls back to the initials from name inside the same fixed box, so the layout never shifts.
Marcus Chen
Sarah Okoro
Priya Nair
<Avatar src="https://i.pravatar.cc/96?img=12" name="Marcus Chen" size="lg" />
<Avatar src="https://i.pravatar.cc/96?img=5" name="Sarah Okoro" size="lg" />
<Avatar src="data:image/jpeg,broken" name="Priya Nair" size="lg" />

Custom content

children replace the initials: an icon for a system account, a count for a group, a glyph for a placeholder.
42
!
<Avatar size="xl" intent="primary">
  <UserIcon size={24} />
</Avatar>
<Avatar size="xl" intent="success">
  <span class="text-lg">42</span>
</Avatar>
<Avatar size="xl" intent="warning" variant="rounded">
  <span class="text-base">!</span>
</Avatar>

For overlapping stacks with an overflow count, see AvatarGroup.

02 Status

status adds a presence dot in the corner set by statusPosition. Each value carries its own colour, and pulse adds a radar ring in the same hue that draws the eye to a presence change.

statusExample
online
AL
away
AT
busy
GH
offline
KJ

03 Customization

Gradient identities

Paint the disc with slotClasses.frame: it keeps the avatar's circular shape, size and centering, and only the gradient fill and initials colour are raw. The intent palette carries no per-identity gradient.
FD
AK
ST
<Avatar
  size="lg"
  slotClasses={{ frame: 'bg-linear-to-br from-violet-500 to-fuchsia-500 text-white' }}
>
  FD
</Avatar>
<Avatar
  size="lg"
  slotClasses={{ frame: 'bg-linear-to-br from-cyan-500 to-blue-500 text-white' }}
>
  AK
</Avatar>
<Avatar
  size="lg"
  slotClasses={{ frame: 'bg-linear-to-br from-amber-400 to-orange-500 text-neutral-900' }}
>
  ST
</Avatar>

This is one of five ways to restyle a block. See Customization for class, slotClasses, unstyled, preset and provider-level overrides.

04 Accessibility

ARIA

An interactive avatar (clickable, interactive, or onclick) carries role="button" and an aria-label taken from alt or name. A static avatar exposes its name through the image's alt, or renders initials. The presence dot is announced separately, as an image labelled “Status: online”. Hide a purely decorative avatar with aria-hidden.

Keyboard

Interactive avatars are focusable with Tab and activate on Enter / Space. A static avatar is skipped in the tab order.

Image fallback

When the image is missing or fails to load, the avatar falls back to children if given, otherwise to the initials from name, so it is never empty.

Motion and contrast

The pulse ring stops animating under prefers-reduced-motion. Under prefers-contrast: more the disc gains a delineating outline.

05 API Reference

25 props
25 props
Prop
Type
Default
Description

06 Types

Local type definitions used by this component.

7 types
Name
Kind
Category
Used by
Description

07 Installation

Import

import { Avatar } from '@urbicon-ui/blocks';