Avatar
A visual representation of a user, team, or entity.
- Status
- Ready
- Code
- In React
- Role
- Display
Usage
This demo is live, and the code below it is the same code, imports included. The component lives in src/ui of this repository and is not published to npm yet.
Pastes as editable layers. Shadows are not exported.
import { useState } from "react";
import { Avatar, Input, type AvatarSize } from "@/ui";
const sizes: AvatarSize[] = ["sm", "md", "lg"];
export default function AvatarDemo() {
const [name, setName] = useState<string>("Natuna Digilab");
return (
<>
{sizes.map((size) => (
<Avatar key={size} name={name || "?"} size={size} />
))}
<Input label="Name" value={name} onChange={(e) => setName(e.target.value)} />
</>
);
}Variants and states
Every specimen is the real component from src/ui, held in one state.
Initials come from the first and last word of the name, so a one-word name gives one letter.
Pastes as editable layers. Shadows are not exported.
Props
- name
- string · default none
- Full name. Initials come from the first and last word, and the name is the accessible label.
- size
- "sm" | "md" | "lg" · default "md"
- 32, 40, or 56px.
- className
- string · default ""
- Extra classes, added after the size classes.
- ...rest
- HTMLAttributes<HTMLSpanElement> · default none
- Every other native span attribute. They are spread last, so an aria-label you pass replaces the name as the accessible label, and aria-hidden hides the avatar.
Figma to code
Figma properties by their exact names from Naming, and the React prop that carries each one. The table covers the shared properties that bear on this component; the Figma file decides which of them its component exposes. None means there is no prop for it yet.
- 📐 Size
- size
- sm, md, and lg.
- 📷 Show Image
- None
- No prop yet. Avatar renders initials only and takes no image source.
- 🎯 State
- None
- No prop. An avatar is not interactive, so it has no states.
Accessibility
What the code in src/ui does today, and what it leaves to you.
Keyboard
- Not focusable and not interactive. Tab skips it.
Screen readers
- Exposed as an image (role="img") named by the full name, so a screen reader reads Natuna Digilab, not N D.
- The initials themselves are aria-hidden.
What you still need to do
- Pass the full name, not initials. The name is the accessible label.
- When the same name is written right next to the avatar, pass aria-hidden="true" so the name is not read twice.
- If the avatar should open a profile, wrap it in a link or button that has its own name. The avatar is not focusable.
When to use
Shows identity in tables, comments, and headers.
Do and don't
Do
- Pass the full name. Initials come from the first and last word, so Natuna Digilab shows ND.
- Keep one size within the same list or table.
Don't
- Pass initials or a nickname as the name. The name is also what a screen reader reads.
- Expect Avatar to show a photo or a logo. It renders initials only and has no image prop yet.
Related
4 of 16 other atoms, same role and ready ones first.
- BadgeA small label used to highlight status, category, or count.Ready
- ChipA compact label for a category, filter, or selected value.Ready
- CommentA single message in a discussion, with author, time, and text.Ready
- HeadlineA page or section title set in the Urbanist header scale.Ready
Status reflects the component tracker snapshot of 29 October 2026.