Avatar
User image with fallback initials, status badge and grouping.
Installation
bun add @xerobi/ui
import { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage } from "@xerobi/ui/avatar"This component is client-side. In Astro, hydrate it with a client directive.
Examples
Default
XB
import { Avatar, AvatarFallback, AvatarGroup } from "@xerobi/ui/avatar"
export function AvatarDefault() {
return (
<Avatar>
<AvatarFallback>XB</AvatarFallback>
</Avatar>
)
}Group
AFMKJS
import { Avatar, AvatarFallback, AvatarGroup } from "@xerobi/ui/avatar"
export function AvatarGrouped() {
return (
<AvatarGroup>
<Avatar><AvatarFallback>AF</AvatarFallback></Avatar>
<Avatar><AvatarFallback>MK</AvatarFallback></Avatar>
<Avatar><AvatarFallback>JS</AvatarFallback></Avatar>
</AvatarGroup>
)
}API reference
Avatar
Also accepts every prop of Base UI Avatar.
| Prop | Type | Description |
|---|---|---|
| size | "default" | "sm" | "lg" |
AvatarBadge
Also accepts every prop of <span> element.
No props of its own.
AvatarFallback
No props of its own.
AvatarGroup
Also accepts every prop of <div> element.
No props of its own.
AvatarGroupCount
Also accepts every prop of <div> element.
No props of its own.
AvatarImage
No props of its own.
Styling hooks: [data-slot="avatar"], [data-slot="avatar-image"], [data-slot="avatar-fallback"], [data-slot="avatar-badge"], [data-slot="avatar-group"], [data-slot="avatar-group-count"].