Display · Avatarstable
Avatar
Represents a person or an organisation with a photo, initials or an icon. Five sizes, circle for people and square for organisations, six tints. Falls back from image to initials to icon.
Preview
#previewChange the options and the code follows. Show code opens the React snippet.
avatar-example.tsx
import { Avatar } from "@blade-ai/weft/components/avatar";
<Avatar
initials="RC"
alt="Romeet Chatterjee"
/>All states
#all-statesSizes, shapes, initials and icon fallbacks in every colour, from the Avatar artboard.
Props
#propsRead from the component source. Booleans are is-prefixed. A star marks a required prop.
Prop
Type
Default
Description
src
string
—
Image URL. Falls back to initials, then the icon, if it fails to load.
alt
string
""
Alt text for the image; also the accessible name of initials / icon avatars.
initials
string
—
Up to two letters shown when there is no image.
icon
ReactNode
—
Icon element shown when there is no image or initials. Sized by the avatar.
size
"xs" | "sm" | "md" | "lg" | "xl"
"md"
20 / 24 / 32 / 40 / 48px.
shape
"circle" | "square"
"circle"
"circle" or flat "square".
color
"neutral" | "primary" | "positive" | "negative" | "notice" | "information"
"neutral"
Tint for initials and icon avatars.
Usage
#usageShort rules for choosing and writing avatar.
Do
Use circles for people and squares for merchants, banks or apps.
Show the name next to the avatar in lists and menus.
Provide alt text when no name is visible nearby.
Don't
Mix shapes for the same kind of entity.
Rely on initials alone to identify someone.
Use colour to carry meaning without a text alternative.
Accessibility
#accessibilityDecorative when a visible name is nearby; named with alt otherwise.
ARIA
Element
Role / attribute
When
Avatar with alt
role="img" · aria-label = alt
Use when no visible name sits next to the avatar.
Avatar without alt
aria-hidden="true"
Decorative; the visible name is read instead.
Interactive avatar
wrap in a button with aria-label
The avatar itself is not focusable.