Avatar

An image that represents a person on your platform.

Pro component

Requires all-access to use the source code

Apple
Apple
import { Stack } from 'expo-router';
import { View, Text, ScrollView } from 'react-native';

import { Avatar, AvatarFallback, AvatarImage } from '@/components/nativewindui/Avatar';

const TWITTER_AVATAR_URI =
  'https://pbs.twimg.com/profile_images/1782428433898708992/1voyv4_A_400x400.jpg';

export default function AvatarScreen() {
  return (
    <>
      <Stack.Screen
        options={{
          title: 'NativewindUI',
          headerSearchBarOptions: {
            hideWhenScrolling: false,
          },
          headerLargeTitle: true,
          headerTransparent: true,
        }}
      />
      <ScrollView contentInsetAdjustmentBehavior="automatic" className="p-4">
        <View className="border-border bg-card gap-4 rounded-xl border p-4 pb-6 shadow-sm shadow-black/10 dark:shadow-none">
          <Text className="text-foreground text-center text-sm font-medium tracking-wider opacity-60">
            Avatar
          </Text>
          <View className="items-center">
            <Avatar alt="NativewindUI Avatar">
              <AvatarImage source={{ uri: TWITTER_AVATAR_URI }} />
              <AvatarFallback>
                <Text className="text-white">NUI</Text>
              </AvatarFallback>
            </Avatar>
          </View>
        </View>
      </ScrollView>
    </>
  );
}

Installation

1

Run the following command:

npx nwui-cli@latest add avatar
🚀
Ship.
1

Add the following dependency to your project:

npx expo install @rn-primitives/avatar
2

Copy/paste the following code to the specified file path:

@/components/nativewindui/Avatar.tsx
import * as AvatarPrimitive from '@rn-primitives/avatar';

import { cn } from '@/lib/cn';

function Avatar({ className, ...props }: AvatarPrimitive.RootProps) {
  return (
    <AvatarPrimitive.Root
      className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)}
      {...props}
    />
  );
}

function AvatarImage({ className, ...props }: AvatarPrimitive.ImageProps) {
  return (
    <AvatarPrimitive.Image className={cn('aspect-square h-full w-full', className)} {...props} />
  );
}

function AvatarFallback({ className, ...props }: AvatarPrimitive.FallbackProps) {
  return (
    <AvatarPrimitive.Fallback
      className={cn(
        'bg-muted flex h-full w-full items-center justify-center rounded-full',
        className
      )}
      {...props}
    />
  );
}

export { Avatar, AvatarFallback, AvatarImage };
🛸
Ship.

Usage

import { Avatar, AvatarFallback, AvatarImage } from '@/components/nativewindui/Avatar';
<Avatar alt="NativewindUI Avatar">
  <AvatarImage
    source={{
      uri: 'https://pbs.twimg.com/profile_images/1782428433898708992/1voyv4_A_400x400.jpg',
    }}
  />
  <AvatarFallback>
    <Text className="text-foreground">NUI</Text>
  </AvatarFallback>
</Avatar>

Props

Avatar

Inherits all the props from @rn-primitives's Root component.

AvatarImage

Inherits all the props from @rn-primitives's Image component.

AvatarFallback

Inherits all the props from @rn-primitives's Fallback component.

© Ronin Technologies LLC 2025