šŸ“„ radixui/primitives/docs/components/avatar

File: avatar.md | Updated: 11/15/2025

Source: https://www.radix-ui.com/primitives/docs/components/avatar

Radix Homepage

Made by WorkOS

Radix Homepage

Made by WorkOS

ThemesThemes PrimitivesPrimitives IconsIcons ColorsColors

Documentation Case studies Blog

Search

/

Overview

Introduction Getting started Accessibility Releases

Guides

Styling Animation Composition Server-side rendering

Components

Accordion Alert Dialog Aspect Ratio Avatar Checkbox Collapsible Context Menu Dialog Dropdown Menu Form

Preview
Hover Card Label Menubar Navigation Menu One-Time Password Field

Preview
Password Toggle Field

Preview
Popover Progress Radio Group Scroll Area Select Separator Slider Switch Tabs Toast Toggle Toggle Group Toolbar Tooltip

Utilities

Accessible Icon Direction Provider Portal Slot Visually Hidden

Components

Avatar

An image element with a fallback for representing the user.

PD

index.jsxindex.jsxstyles.cssstyles.css

CSS

import * as React from "react";
import { Avatar } from "radix-ui";
import "./styles.css";

const AvatarDemo = () => (
	<div style={{ display: "flex", gap: 20 }}>
		<Avatar.Root className="AvatarRoot">
			<Avatar.Image
				className="AvatarImage"
				src="https://images.unsplash.com/photo-1492633423870-43d1cd2775eb?&w=128&h=128&dpr=2&q=80"
				alt="Colm Tuite"
			/>
			<Avatar.Fallback className="AvatarFallback" delayMs={600}>
				CT
			</Avatar.Fallback>
		</Avatar.Root>
		<Avatar.Root className="AvatarRoot">
			<Avatar.Image
				className="AvatarImage"
				src="https://images.unsplash.com/photo-1511485977113-f34c92461ad9?ixlib=rb-1.2.1&w=128&h=128&dpr=2&q=80"
				alt="Pedro Duarte"
			/>
			<Avatar.Fallback className="AvatarFallback" delayMs={600}>
				JD
			</Avatar.Fallback>
		</Avatar.Root>
		<Avatar.Root className="AvatarRoot">
			<Avatar.Fallback className="AvatarFallback">PD</Avatar.Fallback>
		</Avatar.Root>
	</div>
);

export default AvatarDemo;

Features

Automatic and manual control over when the image renders.

Fallback part accepts any children.

Optionally delay fallback rendering to avoid content flashing.

Installation


Install the component from your command line.

npm install @radix-ui/react-avatar

Anatomy


Import all parts and piece them together.

import { Avatar } from "radix-ui";

export default () => (
	<Avatar.Root>
		<Avatar.Image />
		<Avatar.Fallback />
	</Avatar.Root>
);

API Reference


Root

Contains all the parts of an avatar.

| Prop | Type | Default | | --- | --- | --- | | asChild<br><br>Prop description | boolean | false |

Image

The image to render. By default it will only render when it has loaded. You can use the onLoadingStatusChange handler if you need more control.

| Prop | Type | Default | | --- | --- | --- | | asChild<br><br>Prop description | boolean | false | | onLoadingStatusChange<br><br>Prop description | function<br><br>See full type | No default value |

Fallback

An element that renders when the image hasn't loaded. This means whilst it's loading, or if there was an error. If you notice a flash during loading, you can provide a delayMs prop to delay its rendering so it only renders for those with slower connections. For more control, use the onLoadingStatusChange handler on Avatar.Image.

| Prop | Type | Default | | --- | --- | --- | | asChild<br><br>Prop description | boolean | false | | delayMs<br><br>Prop description | number | No default value |

Examples


Clickable Avatar with tooltip

You can compose the Avatar with a Tooltip to display extra information.

import { Avatar, Tooltip } from "radix-ui";

export default () => (
	<Tooltip.Root>
		<Tooltip.Trigger>
			<Avatar.Root>…</Avatar.Root>
		</Tooltip.Trigger>

		<Tooltip.Content side="top">
			Tooltip content
			<Tooltip.Arrow />
		</Tooltip.Content>
	</Tooltip.Root>
);

PreviousAspect Ratio

NextCheckbox

Edit this page on GitHub.