Black Friday is here 🔥 Get Wensity Pro for 20% less with

Avatar

A React avatar on Base UI that falls back to colored initials, with status dots, overlapping avatar groups with a +N chip, tooltips, and upload previews.

Loading preview

Examples

Practical examples and common states for the same installable component.

Fallback

Initials or icon when the image is missing or still loading.

examples/avatar-fallback.tsx
import { IconUser } from "@tabler/icons-react";
import {
Avatar,
AvatarFallback,
AvatarImage,
} from "@/components/wensity/avatar";
export function AvatarFallbackDemo() {
return (
<div className="flex gap-4">
<Avatar size="lg">
<AvatarFallback>Parth Sharma</AvatarFallback>
</Avatar>
<Avatar size="lg">
<AvatarFallback>
<IconUser stroke={1.75} />
</AvatarFallback>
</Avatar>
<Avatar size="lg">
<AvatarImage src="/missing.webp" alt="Broken image" />
<AvatarFallback delayMs={300}>Fallback</AvatarFallback>
</Avatar>
</div>
);
}

Status

Online, away, busy, and offline presence indicators.

examples/avatar-status.tsx
import {
Avatar,
AvatarFallback,
AvatarImage,
} from "@/components/wensity/avatar";
export function AvatarStatusDemo() {
return (
<div className="flex gap-4">
<Avatar size="lg" status="online">
<AvatarImage src="/avatars/1.webp" alt="Online" />
<AvatarFallback>Online</AvatarFallback>
</Avatar>
<Avatar size="lg" status="away">
<AvatarFallback>Away</AvatarFallback>
</Avatar>
<Avatar size="lg" status="busy">
<AvatarFallback>Busy</AvatarFallback>
</Avatar>
<Avatar size="lg" status="offline">
<AvatarFallback>Off</AvatarFallback>
</Avatar>
</div>
);
}

Group

Stacked avatars with overflow count and anchored name tooltips.

examples/avatar-group.tsx
import {
Avatar,
AvatarFallback,
AvatarGroup,
AvatarGroupItem,
AvatarImage,
} from "@/components/wensity/avatar";
export function AvatarGroupDemo() {
return (
<AvatarGroup max={4} size="md">
<AvatarGroupItem name="Parth Sharma">
<Avatar>
<AvatarImage src="/avatars/1.webp" alt="Parth Sharma" />
<AvatarFallback>Parth Sharma</AvatarFallback>
</Avatar>
</AvatarGroupItem>
<AvatarGroupItem name="Maya Chen">
<Avatar>
<AvatarImage src="/avatars/2.webp" alt="Maya Chen" />
<AvatarFallback>Maya Chen</AvatarFallback>
</Avatar>
</AvatarGroupItem>
<AvatarGroupItem name="Jordan Lee">
<Avatar>
<AvatarFallback>Jordan Lee</AvatarFallback>
</Avatar>
</AvatarGroupItem>
<AvatarGroupItem name="Sam Ortiz">
<Avatar>
<AvatarFallback>Sam Ortiz</AvatarFallback>
</Avatar>
</AvatarGroupItem>
<AvatarGroupItem name="Riley Park">
<Avatar>
<AvatarFallback>Riley Park</AvatarFallback>
</Avatar>
</AvatarGroupItem>
</AvatarGroup>
);
}

Uploadable

Editable profile avatar with camera overlay on hover.

examples/avatar-upload.tsx
"use client";
import { AvatarUpload } from "@/components/wensity/avatar";
export function AvatarUploadDemo() {
return (
<AvatarUpload
size="xl"
initials="Parth Sharma"
onChange={(file) => console.log(file?.name)}
/>
);
}

Overview

Avatar is a React and Tailwind CSS avatar component on Base UI, in Next.js or any React app, that shows a profile photo and falls back to initials while loading or on error. Pass a name as the fallback text and it shortens it to two initials, splitting on spaces, dots, and @, then picks a stable color from it. A status dot marks online, away, busy, or offline, AvatarGroup overlaps a stack and folds the rest into a +3 chip with name tooltips, and AvatarUpload previews a picked file. Pass alt on AvatarImage, which defaults to empty.

Installation

Run the following command

~/your-project
pnpm dlx wensity@latest add avatar

Usage

Import Avatar from @/components/wensity/avatar and render it anywhere in your React or Next.js app. The source lands in your own repo, so every prop, class and animation below is yours to edit.

app/example.tsx
import {
Avatar,
AvatarFallback,
AvatarImage,
} from "@/components/wensity/avatar";
export function AvatarDemo() {
return (
<Avatar size="lg" status="online">
<AvatarImage src="/avatars/parth.webp" alt="Parth Sharma" />
<AvatarFallback delayMs={600}>Parth Sharma</AvatarFallback>
</Avatar>
);
}

Props

PropTypeDefaultDescription
size"xs" | "sm" | "md" | "lg" | "xl""md"Avatar diameter and the scale of its fallback text.
status"online" | "offline" | "away" | "busy" | null-Presence indicator rendered on the ring.
showStatusbooleanfalseShows the status ring even without an explicit status value.
tooltipReact.ReactNode-Hover tooltip label anchored above the avatar.
interactiveboolean-Subtle hover affordance on the ring. Defaults to true when tooltip is set.
  • Fan Hover Card Stack component preview

    Fan Hover Card Stack

    Hover a stacked profile deck and watch the cards fan outward in sequence while the active one lifts to the front.

  • Follow Cursor Label component preview

    Follow Cursor Label

    A floating label that trails the cursor across your hover targets with an elastic pop-in and a soft spring settle.

  • Tinder-Style Swipe Cards component preview

    Tinder-Style Swipe Cards

    Tinder-style swipe cards where the top card flicks off under your thumb and the one underneath rises in real time.

  • Glass Envelope component preview

    Glass Envelope

    A frosted glass envelope with stacked photo cards that fan on hover, then lift from the frame when opened with a click.