Theme studio

Design a theme, preview it live, then export it. Saved in this browser.

Quick picks #10b981
Generated scale
50100200300400500600700800900
Some text is below AA

Avatar

  • Needs review
  • WCAG 2.2 evidence
  • RTL

A person or organisation shown as a photo, initials or an icon. Fallback order: photo, then initials, then the person icon. Accessibility: a named avatar is an image (<img alt> or role="img" with aria-label), so the name survives a failed photo (WCAG 1.1.1, 4.1.2); a decorative one is hidden. The presence slot sits outside the image, so its status text is announced (1.3.1). Consumer duties: pass the real name; show availability as visible text where it matters, because the presence colours alone do not meet 1.4.1; make the avatar a link or button by wrapping it. Presentational: renders in React Server Components. Only the photo's load-failure handling is a client island (AvatarImage).

import { Avatar } from "@nexera-ui/react";
Loading example…
5
examples
7
props
3
live controls
1
platform
3
WCAG criteria
32
blocks use it

Try every prop. Copy the code.

Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.

Loading…
size
label
isDecorative
Generated code
import { Avatar } from "@nexera-ui/react";

<Avatar />

Examples 4

The same examples as Storybook, rendered live. Open Code to copy one.

With presence

Figma Show status: a Presence in the presence slot, resized to 8, 10, 12 or 14 px. Its status text is announced after the name; the visible status line keeps it readable without colour (WCAG 1.4.1).

Loading example…

Photo fallback

Fallback order: photo, then initials, then the person icon (missing src or an image that fails to load).

Loading example…

With visible name

Next to a visible name the avatar is decorative (isDecorative): screen readers hear the name once.

Loading example…

Right to left

Right-to-left: the presence dot moves to the bottom-left corner (inline end).

Loading example…

Props 7

Press "Try it" on a card to load that prop into the playground.

7 props shown

sizeNexera
"xs" | "sm" | "md" | "lg" | "xl" | "2xl"

Box size: 20, 24, 32, 40, 56 or 72 px. xs replaces the Select-page Avatar.

Default xs
labelNexera
string

Accessible name: the person's or company's name, for example "Ayesha Khan" (WCAG 1.1.1). It becomes the photo's alt, and stays the name when the photo falls back to initials or the icon. Not allowed on a decorative avatar.

Default –
isDecorativeNexera
boolean

Hide the avatar from assistive technology. The avatar repeats a name that is visible next to it, so it is hidden from assistive technology (aria-hidden, empty alt). A presence dot stays readable.

Default false
typeNexera
"initials" | "photo" | "icon" | "company"

What the avatar shows: initials on a brand tint, a photo, a person icon, or a company letter on a rounded square. A photo. A generic person, for someone without a photo or initials. An organisation: a rounded square in the brand colour.

Default initials
initialsNexera
string

One or two letters. Empty initials show the person icon. Fallback letters when the photo is missing or fails to load. Not used by the icon type. Usually the first letter of the company name.

Default –
srcNexera
string | null

Only with type="photo". Image URL. When it is missing or fails to load, the avatar shows initials, or the person icon without them.

Default –
presenceNexera
ReactNode

Availability dot at the bottom inline-end corner, sized for the avatar: pass a <Presence status="online" />. It stays outside the image so its status text is read. Availability dot: pass a <Presence />. Figma has no presence on a company avatar.

Default –

* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.

Accessible by default.

Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.

WCAG 2.2 evidence

3 direct · 0 supporting
  • 1.1.1Non-text ContentLevel A · tested directly
  • 1.3.1Info and RelationshipsLevel A · tested directly
  • 4.1.2Name, Role, ValueLevel A · tested directly

Fits any width.

Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.

0 px · drag the corner

Styling hooks

Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.

Usage
<Avatar className="shadow-sm" />

Used in blocks

Related components