Back to components
ElementAvatarFree

Avatar React component

A user avatar with image, initials or icon fallback, 5 sizes, circle, rounded and square shapes, a presence status dot with pulse, an accent ring and an optional click state.

About the Avatar component

Avatar shows a person's photo, and falls back to their initials on a color picked from their name, or to a person icon when there is no name. The photo fades in once it has loaded. If it fails to load, the fallback stays, so a broken URL never shows a broken image.

size takes xs, sm, md, lg or xl (24 to 80px) or any number of pixels, and shape is circle, rounded or square. status adds an online, offline, busy or away dot, and pulse animates the online dot. ring draws an outline in ringColor with a thin gap between it and the photo. With onClick it becomes a button that scales slightly on hover and tap.

When to use it

Use it in navbars, comment threads, chat lists, team pages and account menus, anywhere a person needs a face or a recognisable initial.

To show several people in a row with a +N count, use Avatar Group.

Installation

Add the Avatar component to your project with the shadcn CLI. It lands in components/avatar.tsx as plain React + Tailwind CSS source you own and can edit.

Install
Copied!
npx shadcn@latest add @reactframe/avatar

Or copy the source by hand and install its dependencies:

Install
Copied!
npm install motion clsx tailwind-merge

Related components

Avatar Group
Free
Context Menu
Free
Divider
Free
Hover Card
Free
Accordion
Free
Confirm Dialog
Free