Avatar
A person or entity, with image and initials fallback.
- Composed
- In the first release
import { Avatar, avatarPrimitive } from "nitro-ui-sdk/avatar";- HeroUI Native
- Avatar
- Expo UI
- No counterpart

Light 
Dark
On this page
Avatar stands in for a person. It shows an image when one is available and initials otherwise. The initials color is chosen from the name, so the same person keeps the same color in light and dark mode.
Use Avatar.Group when several people share one line. People who do not fit become a +N count.
Anatomy
<Avatar.Root name="Ada Lovelace" size="lg">
<Avatar.Image />
<Avatar.Fallback />
</Avatar.Root>
| Part | Description |
|---|---|
Root |
The face, its status, and its accessible name. |
Image |
The photo. Hidden until it has loaded, and hidden after an error. |
Fallback |
Initials, or your own children, while there is no image. |
Group |
An overlapping stack with an overflow count. |
Usage
import { Avatar } from "nitro-ui-sdk/avatar";
export function Person() {
return <Avatar.Root name="Ada Lovelace" size="lg" />;
}
Variants and sizes
variant is circle (default) or rounded. size is sm (32), md (40), lg (64), or xl (96). The numeric sizes "32", "40", "64", and "96" remain valid. md is the default.
<Avatar.Root name="Ada Lovelace" size="xl" variant="rounded" />
The fallback palette is the accent, success, warning, and danger soft pairs. Dark mode uses the dark pair for the same name.
States
Image status is idle, loading, loaded, or error. With no image the status is idle and the initials show. A failed image shows the initials. decorative removes the accessible name when the row beside the avatar already names the person.
Controlled
Pass status and onStatusChange when the parent owns loading. Omit status and the avatar updates itself as the image loads. onStatusChange may call preventDefault(). A controlled avatar reports requested until the parent renders the next status.
const [status, setStatus] = useState<"idle" | "loading" | "loaded" | "error">("loading");
<Avatar.Root
name="Ada Lovelace"
image={photo}
sourceKey="ada"
status={status}
onStatusChange={(next) => setStatus(next)}
/>
Avatar.Group takes max (default 3). When there are more children than max, it shows max - 1 faces and one overflow chip. overflowLabel replaces the spoken “N more”.
Liquid Glass
Avatar does not draw Liquid Glass. The face is an opaque soft color, and a photo covers it.
Props
Root
| Prop | Type | Default | Description |
|---|---|---|---|
name |
string |
— | Used for initials and the accessible name. |
label |
string |
name |
Spoken name when it should differ. |
image |
image source | — | Photo. An async loader also needs sourceKey. |
sourceKey |
string |
— | Identity of an async image. Required when image is a loader. |
variant |
"circle" | "rounded" |
"circle" |
Corner of the face. |
size |
"sm" | "md" | "lg" | "xl" | "32" | "40" | "64" | "96" |
"md" |
Face size in points. |
decorative |
boolean |
false |
Hides the face from assistive tech. |
status |
"idle" | "loading" | "loaded" | "error" |
internal | Controlled image status. |
onStatusChange |
(status, details) => void |
— | Fired before a status commits. |
styles |
AvatarStyles |
— | Per-part style resolvers. |
api |
Controller<AvatarActions> |
— | Attached controller. |
agentId |
string |
— | Stable agent id. |
layout |
layout | — | Extra layout merged onto the root. |
Group
| Prop | Type | Default | Description |
|---|---|---|---|
max |
number |
3 |
Faces before the rest collapse. |
size |
same as Root | "md" |
Applied to children that omit a size. |
variant |
"circle" | "rounded" |
"circle" |
Applied to children that omit a variant. |
overflowLabel |
(count: number) => string |
"{count} more" |
Spoken name of the overflow chip. |
Controller API
import { avatarPrimitive } from "nitro-ui-sdk/avatar";
const api = avatarPrimitive.createApi();
api.current?.getState();
api.current?.setStatus("error", "api");
api.current?.reset("api");
| Action | Signature | Result |
|---|---|---|
getState |
() => AvatarState |
Status, whether an image is set, the initials, and decorative. |
setStatus |
(status, source?) => ChangeStatus |
accepted, requested while controlled, or refused after preventDefault. |
reset |
(source?) => ChangeStatus |
Returns to the status the current image would start in. |
The same status is accepted and does not write again.
Styles
The resolver receives tokens, variant, size, and state.
<Avatar.Root
name="Ada Lovelace"
size="lg"
styles={{
fallback: ({ tokens }) => ({ text: { color: tokens.colors.foreground } }),
}}
/>
Accessibility
Role image. The name is label or name. The value is the initials. A group overflow chip is text named by overflowLabel, and its visible text is +N. Decorative avatars are hidden.
Agent API
Read-only. Role image. The name is the person’s name and the value is the initials. Status changes go through the controller, not through an agent action.
Platform notes
| iOS | Android | |
|---|---|---|
| Drawing | Composed. Initials are text. Photos use the renderer image. | Same composition. |
| Verification | Exercised by the iOS harness on the lanes simulator. | No Kotlin was added for this family. |