Avatar
Profile image with SVG-ready sources, fallback rendering, and multiple glass-aware surface variants.
pnpm dlx @glinui/cli@latest add avatarDesign system team
8 members, 3 online now
Installation
pnpm dlx @glinui/cli@latest add avatarPrefer the package?
Usage
Variants
Every vocabulary variant on the default tone. Omit variant to follow the ambient design style.
import { Avatar } from "@glinui/ui"
export function AvatarVariantsDemo() { return ( <div className="flex flex-wrap items-center gap-3"> <Avatar variant="glinr" fallback="GL" /> <Avatar variant="solid" fallback="GL" /> <Avatar variant="plain" fallback="GL" /> <Avatar variant="soft" fallback="GL" /> <Avatar variant="outline" fallback="GL" /> <Avatar variant="ghost" fallback="GL" /> <Avatar variant="gradient" fallback="GL" /> </div> )}Sizes and shapes
Six sizes, three radii, rings and presence.
import { Avatar } from "@glinui/ui"
export function Demo() { return ( <div className="flex w-full max-w-xl flex-col gap-6"> <div className="flex flex-wrap items-end gap-4"> {(["xs", "sm", "md", "lg", "xl", "2xl"] as const).map((size) => ( <Avatar key={size} size={size} fallback="MK" tone="accent" /> ))} </div> <div className="flex flex-wrap items-center gap-4"> <Avatar size="lg" fallback="AB" radius="lg" tone="info" /> <Avatar size="lg" fallback="CD" radius="md" tone="success" /> <Avatar size="lg" fallback="EF" status="online" ring /> <Avatar size="lg" fallback="GH" status="busy" variant="soft" tone="danger" /> </div> </div> )}In a layout
A members list with roles and presence.
Members
People with access to this workspace.
import { Avatar, Button, Card, CardContent, CardDescription, CardHeader, CardTitle, Separator} from "@glinui/ui"
export function Demo() { const members = [ { initials: "MK", name: "Maya Kovacs", role: "Owner", status: "online" as const, tone: "accent" as const }, { initials: "JO", name: "Jonas Okafor", role: "Admin", status: "away" as const, tone: "success" as const }, { initials: "PN", name: "Priya Nair", role: "Editor", status: "online" as const, tone: "info" as const }, { initials: "DA", name: "Diego Alvarez", role: "Viewer", status: "offline" as const, tone: "warning" as const } ] return ( <Card className="w-full max-w-md"> <CardHeader> <CardTitle>Members</CardTitle> <CardDescription>People with access to this workspace.</CardDescription> </CardHeader> <CardContent className="flex flex-col"> {members.map((member, index) => ( <div key={member.name}> {index > 0 ? <Separator /> : null} <div className="flex items-center gap-3 py-3"> <Avatar fallback={member.initials} tone={member.tone} status={member.status} /> <div className="flex min-w-0 flex-1 flex-col"> <span className="truncate text-sm font-medium">{member.name}</span> <span className="text-xs text-[var(--color-muted)]">{member.role}</span> </div> <Button variant="ghost" size="sm">Manage</Button> </div> </div> ))} </CardContent> </Card> )}With Images
import { Avatar } from "@glinui/ui"
export function AvatarImagesDemo() {
return (
<div className="flex items-center gap-4">
<Avatar src="https://api.dicebear.com/9.x/adventurer/svg?seed=Nova" alt="Nova" variant="default" />
<Avatar src="https://api.dicebear.com/9.x/lorelei/svg?seed=Kai" alt="Kai" variant="glass" />
<Avatar src="https://api.dicebear.com/9.x/bottts/svg?seed=Glin" alt="Glin" variant="liquid" />
<Avatar src="https://api.dicebear.com/9.x/pixel-art/svg?seed=Leo" alt="Leo" variant="matte" />
<Avatar src="https://api.dicebear.com/9.x/thumbs/svg?seed=Aria" alt="Aria" variant="glow" />
</div>
)
}Sizes
Six sizes from xs (24px) to 2xl (80px).
import { Avatar } from "@glinui/ui"
export function AvatarSizeDemo() {
return (
<div className="flex items-end gap-3">
<Avatar size="xs" fallback="XS" alt="Extra small" />
<Avatar size="sm" fallback="SM" alt="Small" />
<Avatar size="md" fallback="MD" alt="Medium" />
<Avatar size="lg" fallback="LG" alt="Large" />
<Avatar size="xl" fallback="XL" alt="Extra large" />
<Avatar size="2xl" fallback="2X" alt="Double extra large" />
</div>
)
}Radius Styles
import { Avatar } from "@glinui/ui"
export function AvatarRadiusDemo() {
return (
<div className="flex items-center gap-4">
<Avatar radius="full" fallback="FU" variant="glass" />
<Avatar radius="lg" fallback="LG" variant="glass" />
<Avatar radius="md" fallback="MD" variant="glass" />
<Avatar radius="square" fallback="SQ" variant="glass" />
</div>
)
}Status Indicator
Show online, offline, busy, or away status with an auto-positioned dot.
Avatar Group
Stack avatars with overlap. Set `max` to cap visible count with a `+N` overflow indicator.
Glass Variants with Status
Combine glass surfaces with status indicators for rich profile displays.
import { Avatar } from "@glinui/ui"
export function AvatarGlassStatusDemo() {
return (
<div className="flex items-center gap-4">
<Avatar src="..." alt="Nova" variant="glass" size="lg" status="online" />
<Avatar src="..." alt="Kai" variant="liquid" size="lg" status="away" />
<Avatar src="..." alt="Glin" variant="matte" size="lg" status="busy" />
<Avatar src="..." alt="Leo" variant="glow" size="lg" status="offline" />
</div>
)
}Copy-Paste Recipes
Drop these Tailwind classes directly into your markup for common avatar patterns.
Image Error Recovery
A broken image source falls back instantly, and if `src` later changes to a valid URL, the image renders again.
import { Avatar } from "@glinui/ui"
export function AvatarErrorDemo() {
return (
<div className="flex items-center gap-3">
<Avatar src="/broken-src.png" alt="Broken" fallback="BR" variant="matte" />
<Avatar src="https://api.dicebear.com/9.x/adventurer/svg?seed=Replaced" alt="Recovered" variant="glass" />
</div>
)
}Accessibility
- Image alt text provided via `alt` prop.
- Fallback text rendered when image fails to load.
- Status indicators include `aria-label` for screen readers.
- Provide a meaningful `alt` for identity-bearing avatars.
- Keep consistent avatar sizes in list/table contexts to reduce visual noise.
- Fallback initials ensure content remains identifiable when images fail.
ARIA Attributes
- `role="img"` on image
- `aria-label` on status dot
Reduced Motion
Hover transitions respect `prefers-reduced-motion`.
Transition effects on hover (scale, shadow) respect `prefers-reduced-motion` via the `motion-reduce:transition-none` utility.
Affected properties
transformbox-shadowAPI Reference
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
variant | SurfaceVariant | ExtraVariant | "default" | "primary" | "secondary" | "destructive" | "success" | "warning" | "info" | "raised" | "frosted" | No | ambient (glinr) | Surface variant. Omit to follow the ambient design style (glinr by default, plain for minimal, glass for glass). |
tone | SurfaceTone | No | neutral | Colour tone for the vocabulary variants. |
size | AvatarSize | No | md | Dimensions: xs=24px, sm=32px, md=40px, lg=48px, xl=56px, 2xl=80px. |
radius | AvatarRadius | No | full | Corner radius style. |
src | string | No | - | Image URL. |
alt | string | No | "" | Alt text; first char used as fallback. |
fallback | string | No | - | Explicit fallback text (overrides alt). |
status | AvatarStatus | No | - | Status indicator dot. |
ring | boolean | No | false | Add ring for grouped/emphasized avatars. |
fallbackClassName | string | No | - | Auto-generated from TypeScript source. |
imgClassName | string | No | - | Auto-generated from TypeScript source. |
Source
Import directly from the package or browse the source on GitHub. Click any file to view it.
Import
import { Avatar } from "@glinui/ui"Source Files
Dependencies
@glinui/uiGenerated API Snapshot
Beta
Generated API Snapshot
BetaAuto-extracted from TypeScript source in packages/ui/src/components/avatar.tsx. This section is in beta and may lag behind hand-curated docs. Regenerate with pnpm --filter @glinui/docs api:generate.
Generated: 2026-10-08T01:41:21.546Z · Full index: /docs/api-metadata
Primary Props Type
AvatarProps
AvatarGroupProps
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
max | number | No | - | Max avatars to show before +N overflow |
spacing | "tight" | "normal" | "loose" | No | "normal" | Overlap spacing |
AvatarProps
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
alt | string | No | "" | - |
fallback | string | No | - | - |
fallbackClassName | string | No | - | - |
imgClassName | string | No | - | - |
radius | AvatarRadius | No | - | - |
ring | boolean | No | - | Ring color for grouped avatars or emphasis |
size | AvatarSize | No | - | - |
src | string | No | - | - |
status | AvatarStatus | No | - | Online/offline status indicator |
tone | SurfaceTone | No | - | Colour tone for the vocabulary variants. |
variant | SurfaceVariant | ExtraVariant | "default" | "primary" | "secondary" | "destructive" | "success" | "warning" | "info" | "raised" | "frosted" | No | - | Visual variant. Omit for the ambient design style (glinr: ringed, raised face). Vocabulary: glinr, solid, plain, soft, outline, ghost, gradient, glass. liquid, matte and glow are avatar-specific. |