Components

Avatar

A circular image container with an accessible fallback for representing users and entities.

Loading...

Installation

Install the registry item directly, then add any package dependencies if you are setting the component up manually.

1

Install the component

Run the registry command below to add avatar to your project.

watermelon add avatar
2

Install manual dependencies

If you are wiring the component manually, install the package dependencies shown below.

npm install @rn-primitives/avatar
3

Import the component

Import Avatar from your local UI registry output.

Import

import { Avatar } from "@/components/ui/avatar";

Import

Import

import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar";
import { Text } from "@/components/ui/text";

Usage

The Avatar primitive uses @rn-primitives/avatar for lazy loading with an accessible AvatarFallback shown before the image resolves.

With Image

Provide a src to load a remote image for the avatar.

Loading...

Fallback Only

When no image is provided, AvatarFallback always renders.

Loading...

Custom Sizes

Use the size prop to switch between the built-in avatar scales.

Loading...

API Reference

proptypedefaultdescription
srcstring-Image source URI passed to AvatarImage.
altstring-Accessible label for the avatar image.
size"default" | "sm" | "lg""default"Selects one of the built-in avatar sizes.