Avatar
UiAvatar shows an image (src) or falls back to initials, with an optional decorative maskShape.
Add an avatar
<template>
<UiAvatar src="/users/jane.jpg" alt="Jane Doe" size="md" />
<UiAvatar initials="JD" size="lg" />
</template>
Apply a mask shape
<template>
<UiAvatar src="/users/jane.jpg" mask-shape="gem" />
<UiAvatar initials="GG" mask-shape="cookie-9" mask-stretch />
</template>
Color initials and placeholders
Initials and placeholder avatars use a light accent tint by default. Set color to tint them with any theme color instead. Image avatars ignore it.
<template>
<UiAvatar initials="JD" color="secondary" />
<UiAvatar initials="AS" color="success" mask-shape="gem" />
</template>
The tint is the theme color's fixed tone at 25% opacity, so it reads the same in light and dark mode.
Set variant to change how the color is applied:
transparent(default): the light tint, letting what's behind show through.tonal: the same light tint, opaque. Use it where avatars overlap other content.filled: the full theme color with contrasting text.
<template>
<UiAvatar initials="JD" color="primary" variant="tonal" />
<UiAvatar initials="AS" color="primary" variant="filled" />
</template>
Show a status indicator
Set status to render a small presence dot on the avatar's bottom-end corner. The dot scales with the avatar size and is ringed with the surface color so it reads on any background.
<template>
<UiAvatar src="/users/jane.jpg" status="online" />
<UiAvatar initials="JD" status="busy" />
<UiAvatar src="/users/jane.jpg" mask-shape="gem" status="away" />
</template>
| Status | Color token |
|---|---|
online | --cffy-success-base |
busy | --cffy-danger-base |
away | --cffy-warning-base |
offline | --cffy-muted-a10 |
status is set, the avatar is wrapped in an .avatar-status-wrapper element so the dot is not clipped by maskShape masks — with a mask, the dot is also nudged inward to stay over the visible shape. UiAvatarGroup styles account for this wrapper, so status avatars can be mixed into groups. Without status, the rendered markup is unchanged.Props
| Prop | Type | Default | Description |
|---|---|---|---|
src | string | — | Image URL. |
alt | string | 'Avatar' | Accessible name. |
initials | string | null | — | Fallback initials when no image is set. |
size | 'sm' | 'md' | 'lg' | 'navbar' | 'menu' | 'sm' | Avatar size. |
maskShape | 'arch' | 'pill' | 'sunny' | 'gem' | 'cookie-6' | 'cookie-9' | 'cookie-12' | 'clover-4' | 'clover-8' | 'bum' | null | — | Decorative mask. |
maskStretch | boolean | false | Stretch the mask to 115%. |
status | 'online' | 'busy' | 'away' | 'offline' | null | — | Presence indicator dot on the avatar's bottom-end corner. |
color | 'primary' | 'secondary' | 'accent' | 'neutral' | 'success' | 'warning' | 'danger' | 'info' | null | — | Tint for initials and placeholder avatars. No effect on image avatars. |
variant | 'transparent' | 'tonal' | 'filled' | null | 'transparent' | Background style for initials and placeholder avatars: see-through tint, opaque tint, or full color. |
Avatar Group
UiAvatarGroup stacks avatars with an overlapping ring, either from an avatars array or by composing UiAvatar instances via the default slot.
Stack avatars from a list
<script setup lang="ts">
const team = [
{ initials: 'JD' },
{ initials: 'AS' },
{ initials: 'MK' },
]
</script>
<template>
<UiAvatarGroup :avatars="team" />
</template>
Collapse overflow with max
Set max to cap the visible avatars; the remainder collapses into a "+N" avatar styled like the initials fallback.
<template>
<UiAvatarGroup :avatars="team" :max="3" />
</template>
max only applies to the avatars prop. When composing UiAvatar instances via the default slot, all of them render — cap the array yourself before passing it to the slot.Compose with the default slot
<template>
<UiAvatarGroup>
<UiAvatar initials="JD" size="md" />
<UiAvatar initials="AS" size="md" />
<UiAvatar initials="MK" size="md" />
</UiAvatarGroup>
</template>
UiAvatarGroup props
| Prop | Type | Default | Description |
|---|---|---|---|
avatars | IAvatarProps[] | — | Avatars to render, in order. Alternative to composing UiAvatar via the default slot. |
max | number | — | Caps the rendered avatars, collapsing the remainder into a "+N" overflow avatar. Only applies to the avatars prop. |
size | 'sm' | 'md' | 'lg' | 'navbar' | 'menu' | 'sm' | Size applied to every avatar in the group (and the overflow avatar). Individual avatars entries can override it. |
color | 'primary' | 'secondary' | … | null | — | Tint applied to every avatar in the group and the overflow avatar. Individual avatars entries can override it; slot-composed avatars set their own. |
variant | 'transparent' | 'tonal' | 'filled' | null | 'tonal' | Background style for every avatar in the group and the overflow avatar. Opaque by default so overlapping avatars don't show through. avatars entries can override it; slot-composed avatars set their own. |
customClass | string | string[] | Record<string, boolean> | null | — | Extra classes for the group container. |
Slots: default — compose UiAvatar instances directly instead of passing avatars.
CSS variables
Set these on :root, or on any wrapper to restyle only the avatars inside it. --cffy-avatar-tint-color applies when no color is set; the color prop keeps its own tint. Mask shapes replace the radius, and the navbar initials keep their small corners.
:root {
--cffy-avatar-radius: var(--cffy-radius-lg);
--cffy-avatar-status-online-color: var(--cffy-info-base);
}
| Variable | Default | Controls |
|---|---|---|
--cffy-avatar-radius | --cffy-radius-full | Corners of image, initials and placeholder avatars |
--cffy-avatar-easing / --cffy-avatar-duration | --cffy-ease-spring / --cffy-duration-600 | Radius and position transitions |
--cffy-avatar-tint-color | --cffy-accent-base-fixed | Initials tint without a color |
--cffy-avatar-tint-alpha | 25% | Strength of the initials and colored placeholder tint |
--cffy-avatar-initials-font-size / --cffy-avatar-initials-font-weight | --cffy-fs-4xs / --cffy-fw-600 | Initials text |
--cffy-avatar-group-overlap | 0.625rem | How far grouped avatars overlap |
--cffy-avatar-group-ring-width / --cffy-avatar-group-ring-color | 2px / --cffy-surface-a0 | Ring that separates grouped avatars |
--cffy-avatar-status-size | 25% | Status dot size, relative to the avatar |
--cffy-avatar-status-ring-width / --cffy-avatar-status-ring-color | 2px / --cffy-surface-a0 | Ring around the status dot |
--cffy-avatar-status-online-color / --cffy-avatar-status-busy-color / --cffy-avatar-status-away-color / --cffy-avatar-status-offline-color | See status colors | Status dot colors |