Documentation Index
Fetch the complete documentation index at: https://mintlify.com/radix-ui/primitives/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Avatar is an image element with a fallback for representing a user or entity. It automatically handles loading states and can show initials or an icon when an image is unavailable.Features
- Automatic and manual control over when the image renders
- Fallback part accepts any children
- Optionally delay fallback rendering to avoid content flashing
Installation
Anatomy
API Reference
Root
Contains all the parts of an avatar.Image
The image to render. By default it will only render when it has loaded.The source of the image.
Alternative text description of the image.
Callback fired when the loading status changes.
Fallback
An element that renders when the image hasn’t loaded. This means whilst it’s loading, or if there was an error.Useful for delaying rendering so it only appears for those with slower connections.
Examples
Basic Usage
Delayed Fallback
The
delayMs prop is useful for preventing the fallback from flashing on screen for users with fast connections.With Loading Status
Accessibility
Adheres to theimg role requirements. The Image component should always have alt text to describe the image for screen reader users.