Skip to content
Docs
Components
Primitives
Avatar

Avatar

Avatar component is used to display user's profile picture or initials or icons along with badges.

Imports

import {
  Avatar,
  AvatarDefaultStatusIndicators,
  AvatarIcon,
  AvatarImage,
  AvatarInitials,
  AvatarStatusIndicator,
  AvatarWrapper,
} from "@adaptui/react-tailwind";
💡

A complex component that supports customization as per the composition guide.

Usage

Avatar sizes

Sizes can be set using the size prop. The default size is xl. The available sizes are: xs sm md lg xl 2xl 3xl

Avatar styles

Avatar comes in two styles, circular & squared

Avatar fallbacks

If there is an error loading the src of the avatar, there are 2 fallbacks:

  • If there's a name prop, we use it to generate the initials.
  • If there's no name prop, we use a default avatar.

If both name and src are not provided you can pass a icon prop to show any content, icon has the lowest priority thus if name or src is provided fallback will be ignored.

Avatar with status indicators

You can show status icons at the right corner of the Avatar using status prop. Each avatar sizes has its own status indicators sizes.

API Reference

Prop

Type

Default

srcstring-
namestring-
squaredbooleanfalse
sizeunionxl
statusunionnone
iconReact.ReactNode-
statusIndicatorsReact.ReactNode-
showRingbooleanfalse
ringColorstringring-white
getInitialsFromNamestring-
parentsBackgroundstring[]["bg-white", "ring-white"]
Last updated on July 27, 2022