HomeDocsComponentsBlocksChartsThemes
Introduction
  • Introduction
  • Installation
  • Themes
  • llms.txt
Components
  • Accordion
  • Alert
  • Alert Dialog
  • Amount
  • Aspect Ratio
  • Audio Player
  • Avatar
  • Avatar Upload
  • Badge
  • Banner
  • Breadcrumb
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Code Block
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Context Menu
  • Copy Button
  • Countdown
  • Data Grid
  • Data Table
  • Date Picker
  • Date Range Picker
  • Description List
  • Device Mockup
  • Dialog
  • Direction
  • Dot Loader
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • File Upload
  • Hover Card
  • Input
  • Input Group
  • Input OTP
  • Item
  • Kanban
  • Kbd
  • Label
  • Menubar
  • Meter
  • Multi Select
  • Native Select
  • Navigation Menu
  • Number Field
  • Pagination
  • Password Strength
  • Phone Input
  • Popover
  • Progress
  • Progress Circle
  • Radio Group
  • Rating
  • Resizable
  • Responsive Dialog
  • Rich Text Editor
  • Scroll Area
  • Segmented Control
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Skeleton
  • Slider
  • Sortable
  • Spinner
  • Stat
  • Stepper
  • Switch
  • Table
  • Tabs
  • Tag Input
  • Terminal
  • Textarea
  • Time Field
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Tree
  • Typography
  • Video Player
  • Window Mockup
AI
  • Message Scroller
  • Message
  • Bubble
  • Marker
  • Attachment
  • Questionnaire
  • Composer
  • Reasoning
  • Tool Call
  • Approval Card
  • Citations
Blocks
  • Airtable
  • Airtable Kanban
  • ClickUp List
  • ClickUp Kanban
  • Repeatable Group
  • Command Palette
  • Sign In and Sign Up
  • Availability Scheduler
  • AI Chat
  • Action Bar
  • Notion
  • Banking
  • Lineup Builder
  • Sports Score
  • Strava
  • Sheets
  • Notices
  • Settings
  • Billing
Utilities
  • motion
  • sounds
  • scroll-fade
  • shimmer
Another UI. Built on shadcn/ui with Phosphor icons.

Avatar

PreviousNext

An image element with a fallback for representing the user.

Base UIReact AriaRadix UI
CNER
CNLRER
+3
import {
  Avatar,
  AvatarBadge,

Installation#

pnpm dlx shadcn@latest add https://anotherui.dev/r/avatar.json

Usage#

import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
<Avatar>
  <AvatarImage src="https://github.com/jvendramin.png" />
  <AvatarFallback>CN</AvatarFallback>
</Avatar>

Composition#

Use the following composition to build an Avatar:

Avatar
├── AvatarImage
├── AvatarFallback
└── AvatarBadge

Use the following composition to build an AvatarGroup:

AvatarGroup
├── Avatar
│   ├── AvatarImage
│   ├── AvatarFallback
│   └── AvatarBadge
├── Avatar
│   ├── AvatarImage
│   ├── AvatarFallback
│   └── AvatarBadge
└── AvatarGroupCount

Basic#

A basic avatar component with an image and a fallback.

CN
import {
  Avatar,
  AvatarFallback,

Badge#

Use the AvatarBadge component to add a badge to the avatar. The badge is positioned at the bottom right of the avatar.

CN
import {
  Avatar,
  AvatarBadge,

Use the className prop to add custom styles to the badge such as custom colors, sizes, etc.

<Avatar>
  <AvatarImage src="https://github.com/jvendramin.png" alt="@jvendramin" />
  <AvatarFallback>CN</AvatarFallback>
  <AvatarBadge className="bg-green-600 dark:bg-green-800" />
</Avatar>

Badge with Icon#

You can also use an icon inside <AvatarBadge>.

PP
import { PlusIcon } from "@phosphor-icons/react"

import {

Avatar Group#

Use the AvatarGroup component to add a group of avatars.

CNLRER
import {
  Avatar,
  AvatarFallback,

Avatar Group Count#

Use <AvatarGroupCount> to add a count to the group.

CNLRER
+3
import {
  Avatar,
  AvatarFallback,

Avatar Group with Icon#

You can also use an icon inside <AvatarGroupCount>.

CNLRER
import { PlusIcon } from "@phosphor-icons/react"

import {

Sizes#

Use the size prop to change the size of the avatar.

CNCNCN
import {
  Avatar,
  AvatarFallback,

Dropdown#

You can use the Avatar component as a trigger for a dropdown menu.

"use client"

import {

RTL#

To enable RTL support, see the RTL configuration guide.

CNER
CNLRER
+Ù£
"use client"

import * as React from "react"

API Reference#

Avatar#

The Avatar component is the root component that wraps the avatar image and fallback.

PropTypeDefault
size"default" | "sm" | "lg""default"
classNamestring-

AvatarImage#

The AvatarImage component displays the avatar image. It accepts all Base UI Avatar Image props.

PropTypeDefault
srcstring-
altstring-
classNamestring-

AvatarFallback#

The AvatarFallback component displays a fallback when the image fails to load. It accepts all Base UI Avatar Fallback props.

PropTypeDefault
classNamestring-

AvatarBadge#

The AvatarBadge component displays a badge indicator on the avatar, typically positioned at the bottom right.

PropTypeDefault
classNamestring-

AvatarGroup#

The AvatarGroup component displays a group of avatars with overlapping styling.

PropTypeDefault
classNamestring-

AvatarGroupCount#

The AvatarGroupCount component displays a count indicator in an avatar group, typically showing the number of additional avatars.

PropTypeDefault
classNamestring-

For more information about Base UI Avatar props, see the Base UI documentation.

Audio PlayerAvatar Upload

On This Page

InstallationUsageCompositionBasicBadgeBadge with IconAvatar GroupAvatar Group CountAvatar Group with IconSizesDropdownRTLAPI ReferenceAvatarAvatarImageAvatarFallbackAvatarBadgeAvatarGroupAvatarGroupCount