Components
Avatar
A circular image container with an accessible fallback for representing users and entities.
Installation
Install the registry item directly, then add any package dependencies if you are setting the component up manually.
Install the component
Run the registry command below to add avatar to your project.
watermelon add avatarInstall manual dependencies
If you are wiring the component manually, install the package dependencies shown below.
npm install @rn-primitives/avatarImport 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.
Fallback Only
When no image is provided, AvatarFallback always renders.
Custom Sizes
Override the default 40×40 size with NativeWind classes.
API Reference
| prop | type | default | description |
|---|---|---|---|
| src | string | - | Image source URI passed to AvatarImage. |
| alt | string | - | Accessible label for the avatar image. |
| className | string | - | Override classes on the Avatar root container. |