Skip to main content

Avatar

Avatar displays a user or entity with an image, initials fallback, or placeholder icon.

Open in Storybook

Import​

import { Avatar } from "@tosui/react";

Basic usage​

Sizes​

JD
JD
JD
JD

Initials fallback​

When no image is provided, Avatar shows initials from the name.

JD
JS
A
BB

Placeholder​

When no name or image is provided, a placeholder icon is shown.

Rounded variants​

JD
JS

Image error fallback​

If the image fails to load, Avatar falls back to initials.

<Avatar
src="https://broken-url.example/image.jpg"
name="John Doe"
/>
// Falls back to "JD" initials

Common patterns​

Avatar with name​

Avatar group​

A
B
C
D

Props reference​

PropTypeDefaultDescription
srcstring-Image source URL
namestring-Name for initials fallback
size"sm" | "md" | "lg" | "xl""md"Avatar size
rounded"full" | "md""full"Border radius
altstringname or "Avatar"Alt text for image
classNamestring-Additional CSS class

Size dimensions​

SizeDimensions
sm32px
md40px
lg48px
xl64px

TypeScript​

import { Avatar, type AvatarSize, type AvatarProps } from "@tosui/react";