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

AvatarLabel

  • Stable
  • WCAG 2.2 evidence
  • RTL

An avatar with a name and an optional subtitle beside it, for a person in a list, a header or a mention. The name is real text and the avatar repeats it, so the avatar is decorative and hidden from assistive technology: a screen reader reads "Ayesha Khan, Senior product designer" once (WCAG 1.1.1, 1.3.1). Names and subtitles wrap, never truncate (1.4.10, 1.4.12). Presentational: renders in React Server Components, without React Aria. Consumer duties: write the real name; keep the subtitle short and meaningful on its own; for a person with a status, put the Presence in the avatar you pass and write the status as visible text somewhere (1.4.1). Make the label a link or button by wrapping it. In dense tables use the table cell variant instead.

import { AvatarLabel } from "@nexera-ui/react";
Loading example…
6
examples
4
props
1
live controls
1
platform
6
WCAG criteria
9
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
Generated code
import { AvatarLabel } from "@nexera-ui/react";

<AvatarLabel />

Examples 5

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

Name only

Without a subtitle the name is centred against the avatar.

Loading example…

With photo and presence

Pass any Avatar in avatar: the label sets its size and makes it decorative, because the name is written beside it.

Loading example…

Long content

Long names and subtitles wrap in a narrow container; nothing is cut off and nothing scrolls the page at 320 px.

Loading example…

In a list

In a list, each person is one readable line of text: "Ayesha Khan, Senior product designer".

Loading example…

Right to left

Right-to-left: the avatar moves to the right, the text aligns to the start and the initials follow the name.

Loading example…

Props 4

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

4 props shown

name*Nexera
string

The person's or team's name. It is the accessible name of the whole label, and the source of the default initials.

Default –
subtitleNexera
ReactNode

The second line, for example a job title or an email. Shown when provided. It wraps; it is never cut off.

Default –
avatarNexera
ReactNode

The avatar: pass an Avatar element with isDecorative, for example a photo, because the name is written next to it. The label sets its size and keeps it decorative. When it is left out the label draws an initials avatar from the first letters of the first and last word of name; null shows no avatar.

Default –
sizeNexera
"sm" | "md" | "lg"

Size of the label and of its avatar: 24, 32 or 40 px, with the text styles of that size.

Default sm

* 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 · 3 supporting
  • 1.1.1Non-text ContentLevel A · tested directly
  • 1.3.1Info and RelationshipsLevel A · tested directly
  • 1.3.2Meaningful SequenceLevel A · supporting test
  • 1.4.10ReflowLevel AA · supporting test
  • 1.4.12Text SpacingLevel AA · supporting test
  • 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
<AvatarLabel className="shadow-sm" />

Used in blocks

Related components