Rebar UI

1.1

imitation

Avatar

A person, as initials or a portrait.

AvatarPortraits, initials, three sizes
MC

Maya Chen

JW

Jonas Weber

PN

Priya Nair

LS

Leo Santos

Initials
MCJWPNLS
Sizes
MCMCMC
Group
MCJWPNLS
Overflow
MCJWPN+3
Presence
MC
Fallback
?

In context

Crew listPortrait, name, role and presence
MC
Maya ChenDesign
Online
JW
Jonas WeberEngineering
In a meeting
PN
Priya NairResearch
Away
LS
Leo SantosOperations
Online
All portraits96 built-in portraits; placeholder={n} picks one, placeholder picks by name
01234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495

Upload overlay

Avatar with upload overlayEdit band, spinner while uploading, camera badge; click the photo
MKEdit

Tap the photo to change it.

Overlay “Edit”
MKEdit
Uploading
MKEdit
Camera badge
MK
Sizes (56, 72)
MKMK
Upload failed
MK

Try a smaller photo

Your DetailsIn context: uploading, then updated

Your Details

Profile

MK

Username

maria_k

Your Details

Profile

MKEdit

Username

maria_k

Tap the photo to change it.

Props

PropTypeRequiredDefault
srcstring | undefinedNo—
thumbSrcstring | undefinedNo—
altstring | undefinedNo—
fallbackstringYes—
classNamestring | undefinedNo—
placeholdernumber | boolean | undefinedNo—
sizenumber | "sm" | "md" | "lg" | "xl" | undefinedNomd
overlayReactNodeNo—
overlayStyle"band" | "full" | undefinedNo—
spinnerReactNodeNo—
badgeReactNodeNo—
loadingboolean | undefinedNo—
invalidboolean | undefinedNo—

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.

PropertyDefault
--rebar-avatar-backgroundvar(--rebar-color-tint-3)1.1
--rebar-avatar-image-radius01.1
--rebar-avatar-overflowhidden1.1
--rebar-avatar-overlay-bgrgba(10, 11, 22, 0.35)1.1
--rebar-avatar-overlay-size11px1.1
--rebar-avatar-overlay-weight7001.1
--rebar-avatar-ringvar(--rebar-avatar-shadow, 0 0 0 2px var(--rebar-color-bg-raised))1.1
--rebar-avatar-shadow0 0 0 2px var(--rebar-color-bg-raised)1.1