Avatar
Avatar
Section titled “Avatar”Category: Media
<Avatar src="/u/alice.jpg" alt="Alice Liddell" fallback="AL" /><Avatar fallback="?" size="lg" /><Avatar shape="square" fallback="ML" />Install: @helix-ui/core
import { Avatar } from '@helix-ui/core';status: stable · since: 0.1.0
Tags: user, identity, image, fallback, circle
Live playground
Section titled “Live playground”Open the full editor or source on GitHub.
Anatomy
Section titled “Anatomy”● ← circular image; if missing → initials on tinted bgLayout
Section titled “Layout”- display —
inline-block - width —
content - height —
content - intrinsicSize —
24/32/40/48/64px square (xs/sm/md/lg/xl) - stackable —
true - fullBleed —
false
Visual
Section titled “Visual”A circular image with rounded fallback when the image fails to load. Fallback shows uppercase initials on a deterministic tinted background derived from the name. Optional ring (border) or PresenceDot can sit on top.
| Name | Type | Default | Description |
|---|---|---|---|
src |
string |
— | Image URL. |
alt |
string |
— | Accessible label. Used as aria-label. If empty, fallback is used. |
fallback |
string |
— | Text to display when no image is available — typically initials. |
size |
'xs' | 'sm' | 'md' | 'lg' | 'xl' |
md |
Avatar size. |
shape |
'circle' | 'square' |
circle |
Avatar shape. |
Tokens used
Section titled “Tokens used”color.bg.action.neutral.default, color.text.secondary, font.family.sans, font.weight.semibold, font.size.xs, font.size.sm, font.size.md, font.size.xl, radius.full, radius.md
Accessibility
Section titled “Accessibility”Notes
- Always pass
altwhen the avatar identifies a real person or entity. Use emptyalt=""only when the avatar is purely decorative and accompanied by visible text. - Initials in
fallbackshould be 1–2 characters.
Composes with
Section titled “Composes with”| Component | Relation | Note |
|---|---|---|
AvatarGroup |
child |
Used inside AvatarGroup for stacked rows. |
PresenceDot |
sibling |
Render PresenceDot anchored to the avatar. |
ChatMessage |
child |
Common as the leading slot of a ChatMessage. |
Prompt examples
Section titled “Prompt examples”These are the AI prompt → JSX mappings used by the helix-ui prompt DSL and integrations like Cursor / Claude Code.
user avatar with initials fallback
Section titled “user avatar with initials fallback”“avatar for “Sara Tang”“
<Avatar src={user.imageUrl} fallback="ST" alt="Sara Tang" />large avatar in a profile header
Section titled “large avatar in a profile header”“64px avatar in a profile card”
<Avatar size="xl" src={user.imageUrl} fallback="ST" />