# Avatar

> Atom — orn-ui

> ⚠️ Requires <UIProvider>: This component (like every orn-ui component) must render inside a <UIProvider> ancestor, or it throws at runtime. See https://orn-ui-docs.vercel.app/getting-started.md

> Runs on Expo SDK 54, 55, 56 and 57, and on bare React Native >=0.81 with react >=19.1. No native modules — works in Expo Go, no prebuild.

## Installation

Install just this component (copies the source into your project, no npm dependency)
```bash
npx orn-ui add avatar
```

Or install the whole package and import it
```tsx
pnpm add orn-ui
import { Avatar } from 'orn-ui/avatar';
```

Depends on: core (theme + icons)

## Variants

### With icon

```tsx
<Avatar size={44}>
  <Icon name="check" size={20} />
</Avatar>
```

### With initials

```tsx
<Avatar size={44}>
  <Body style={{ fontWeight: '700' }}>JD</Body>
</Avatar>
```

### Sizes

```tsx
<VariantRow>
  <Avatar size={28}>
    <Body style={{ fontWeight: '700', fontSize: 11 }}>SM</Body>
  </Avatar>
  <Avatar size={44}>
    <Body style={{ fontWeight: '700' }}>MD</Body>
  </Avatar>
  <Avatar size={64}>
    <Body style={{ fontWeight: '700', fontSize: 18 }}>LG</Body>
  </Avatar>
</VariantRow>
```

### Custom color

```tsx
<Avatar size={44} backgroundColor="#00cae130">
  <Icon name="info" size={22} color="#00cae1" />
</Avatar>
```

## Full demo source

```tsx
const variants: VariantDef[] = [
  {
    label: 'With icon',
    content: (
      <Avatar size={44}>
        <Icon name="check" size={20} />
      </Avatar>
    ),
  },
  {
    label: 'With initials',
    content: (
      <Avatar size={44}>
        <Body style={{ fontWeight: '700' }}>JD</Body>
      </Avatar>
    ),
  },
  {
    label: 'Sizes',
    content: (
      <VariantRow>
        <Avatar size={28}>
          <Body style={{ fontWeight: '700', fontSize: 11 }}>SM</Body>
        </Avatar>
        <Avatar size={44}>
          <Body style={{ fontWeight: '700' }}>MD</Body>
        </Avatar>
        <Avatar size={64}>
          <Body style={{ fontWeight: '700', fontSize: 18 }}>LG</Body>
        </Avatar>
      </VariantRow>
    ),
  },
  {
    label: 'Custom color',
    content: (
      <Avatar size={44} backgroundColor="#00cae130">
        <Icon name="info" size={22} color="#00cae1" />
      </Avatar>
    ),
  },
];
return <VariantList variants={variants} />;
```

## Props

| Name | Type | Default | Description |
|---|---|---|---|
| `size?` | `number` | 44 | — |
| `backgroundColor?` | `string` | — | — |
| `style?` | `StyleProp<ViewStyle>` | — | — |
