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

Size Dimensions

SizeDimensions
sm32px
md40px
lg48px
xl64px

TypeScript

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