Skip to content

Avatar ​

Avatar displays a user image, initials, or icon. Pair with gk-avatar-group for overlapping stacks and overflow.

Demos ​

Size

Named sizes sm, md, lg, or a custom pixel value via size="48". Portrait photos use object-fit: cover by default.

Shape

Default corners use a small radius. Set round for a circle.
AB

Color

Use color as the background when showing initials or icons.
GKUIER

Icon

Put any icon (inline SVG, emoji, etc.) in the default slot. There is no built-in icon set.

Fallback

When src fails to load, the default slot (e.g. initials) is shown instead.
FBNA

Avatar Group

max limits visible avatars. Put a custom +N control in the overflow slot (here 5 avatars, max="3" → +2). The group also reflects remaining count as rest.
DE+2

API ​

Avatar Props ​

PropTypeDefault
srcstring—
altstring''
size'sm' | 'md' | 'lg' | \${number}``'md'
roundbooleanfalse
colorstring—
object-fitstring'cover'

Avatar Slots ​

NameDescription
defaultInitials, icon, or fallback content when there is no image

Avatar CSS Parts ​

PartDescription
baseOuter surface
image<img> when src loads
contentWrapper around the default slot

AvatarGroup Props ​

PropTypeDefault
maxnumber—
size'sm' | 'md' | 'lg' | \${number}``—
restnumber (reflected)0

When size is set on the group, it is applied to child avatars for consistent overlap.

AvatarGroup Slots ​

NameDescription
defaultgk-avatar children
overflowCustom overflow UI (e.g. +N); shown when rest > 0