Skip to content

Avatar

Shows an image or initials for a person.

avatar-basic-demo.tsx

Installation

The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.

Sizes

avatar-sizes-demo.tsx

Fallback

Initials show until the image loads, and if it fails. Set initials="" to show a person icon.

avatar-fallback-demo.tsx

Group

Give AvatarGroup an aria-label. Show the people not shown as a count, such as +2.

avatar-demo.tsx

API reference

name: stringRequired
Accessible name. Avatar takes the initials from it.
src: string
Image URL. Avatar shows initials if the image is missing or does not load.
initials: string
Replaces the initials that Avatar takes from name. Set "" to show a person icon.
size: "xs" | "sm" | "md" | "lg" | "xl" = "md"
Diameter of the avatar: 24, 32, 40, 48, or 64 pixels. The initials scale with it.