Install
Pull Avatar from the barrel for everyday use, or the granular path when you want a tighter bundle.
import { Avatar } from "@brika/clay";import { Avatar } from "@brika/clay/components/avatar";A minimal example
Drop this into a page. Native HTML attributes pass through to the underlying primitive.
import {
Avatar,
AvatarFallback,
AvatarImage,
} from '@brika/clay/components/avatar';
/** Default avatar with a remote image and initials fallback. */
export default function AvatarDefaultDemo() {
return (
<Avatar>
<AvatarImage src="https://api.dicebear.com/9.x/initials/svg?seed=Alicia" alt="Alicia Reyes" />
<AvatarFallback>AR</AvatarFallback>
</Avatar>
);
}Avatar, every way
Badge
AvatarBadge overlays a status indicator in the bottom-right corner.
Fallback
When the image URL fails or is omitted, initials render in the fallback slot.
Group
Stacked AvatarGroup with a count bubble for the remaining members.
Sizes
Three preset sizes, `sm` (24px), `default` (32px), and `lg` (40px).
Accessibility
-
AvatarImagerequires analtattribute; use the user's name, oralt=""for decorative use. -
AvatarFallbackis visible only when the image fails or is missing; AT reads the fallback text. - Status badge text should be wrapped in an
aria-labelwhen it conveys meaning (e.g. "Online").
Theme tokens
Every CSS variable Avatar reads, with its default and the
dotted path you'd write in a ThemeConfig JSON
to override it. Set any of these in your theme to retune Avatar
without touching component code.
Avatar tokens
8 tokens--avatar-fallback-containercolorvar(--muted)components.avatar.fallbackContainerBackground of the avatar fallback (and the `<AvatarGroupCount>` chip).
--avatar-fallback-labelcolorvar(--muted-foreground)components.avatar.fallbackLabelText color (initials) of the avatar fallback.
--avatar-badge-containercolorvar(--primary)components.avatar.badgeContainerBackground of the small `<AvatarBadge>` indicator pinned to the bottom-right corner.
--avatar-badge-labelcolorvar(--primary-foreground)components.avatar.badgeLabelForeground (icon / count) color of the `<AvatarBadge>` indicator.
--avatar-ring-colorcolorvar(--background)components.avatar.ringColorColor of the 2px ring drawn around the avatar badge and around grouped avatars to separate them from the surrounding surface.
--avatar-sizesize2remcomponents.avatar.sizeAvatar diameter at the default size.
--avatar-group-spacingsize0.5remcomponents.avatar.groupSpacingNegative inline overlap between adjacent avatars inside an `<AvatarGroup>`. Larger values pull stacked avatars further apart.
--avatar-radiusradius9999pxcomponents.avatar.radiusAvatar corner radius. Default is fully circular.
Override in a theme
Authoring a theme is plain JSON. Drop overrides under
components.avatar, the names
are camelCase versions of the variable suffix.
{
"id": "my-theme",
"name": "My Theme",
"description": "...",
"accentSwatches": ["#000"],
"components": {
"avatar": {
"radius": "9999px"
}
}
}
Then apply with applyTheme(myTheme)
(see the theming guide),
scope it to a subtree with themeToCssVars(myTheme, mode),
or consume any token directly in your own JSX with the matching Tailwind utility
(e.g. bg-avatar-…) — see the
chips on each token row.
API reference
Props specific to Avatar. Native HTML attributes pass through to the underlying primitive, see the component source on GitHub for the full type signature.
<Avatar />
1 prop- sizedefault
'default''default' | 'sm' | 'lg'Preset diameter.
<AvatarBadge />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<AvatarFallback />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<AvatarGroup />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<AvatarGroupCount />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<AvatarImage />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.