Avatar
A person, as initials or a portrait.
Maya Chen
Jonas Weber
Priya Nair
Leo Santos
In context
Upload overlay
Tap the photo to change it.
Try a smaller photo
Your Details
Profile
Username
maria_kYour Details
Profile
Username
maria_kTap the photo to change it.
Props
| Prop | Type | Required | Default |
|---|---|---|---|
src | string | undefined | No | — |
thumbSrc | string | undefined | No | — |
alt | string | undefined | No | — |
fallback | string | Yes | — |
className | string | undefined | No | — |
placeholder | number | boolean | undefined | No | — |
size | number | "sm" | "md" | "lg" | "xl" | undefined | No | md |
overlay | ReactNode | No | — |
overlayStyle | "band" | "full" | undefined | No | — |
spinner | ReactNode | No | — |
badge | ReactNode | No | — |
loading | boolean | undefined | No | — |
invalid | boolean | undefined | No | — |
Accessibility
The initials are real text in the DOM, read even when no image loads. Pass a meaningful alt with a real src; with only fallback or placeholder the image is decorative and alt stays empty.
data-rebar-* attributes
data-rebar-component="avatar", data-rebar-size; data-rebar-part="fallback" on the initials.
Migrating to Ant Design
Not codemod-covered: AntD's Avatar takes fallback content as children, not a fallback prop, and has no illustrated placeholder, so a placeholder avatar needs a real src or plain initials.
thumbSrc blur-up
Pass thumbSrc (a tiny image) to show it blurred straight away while src loads, then fade the real image in, the same blur-up as Image. The initials stay hidden behind the thumb unless the image fails.
<Avatar src={photo} thumbSrc={photoTiny} fallback="MK" />overlayStyle="full"
overlayStyle="full" makes the overlay cover the whole picture with a dim layer and a centred label (--rebar-avatar-overlay-bg / -size / -weight); while loading the label gives way to spinner and the separate scrim is not drawn. --rebar-avatar-overflow, --rebar-avatar-image-radius, --rebar-avatar-background and --rebar-avatar-ring (theme) adjust how the picture is clipped and backed.
Tokens
Custom properties, set on the component or any ancestor. The default is what applies when one is unset. 8 of 8 were added in 1.1.0 and are marked.
| Property | Default | |
|---|---|---|
--rebar-avatar-background | var(--rebar-color-tint-3) | 1.1 |
--rebar-avatar-image-radius | 0 | 1.1 |
--rebar-avatar-overflow | hidden | 1.1 |
--rebar-avatar-overlay-bg | rgba(10, 11, 22, 0.35) | 1.1 |
--rebar-avatar-overlay-size | 11px | 1.1 |
--rebar-avatar-overlay-weight | 700 | 1.1 |
--rebar-avatar-ring | var(--rebar-avatar-shadow, 0 0 0 2px var(--rebar-color-bg-raised)) | 1.1 |
--rebar-avatar-shadow | 0 0 0 2px var(--rebar-color-bg-raised) | 1.1 |