# Avatar

Source: https://ecosphere.dev/docs/data/avatar (Ecosphere 1.5). Install `vue-ecosphere` for Vue 3 or `react-ecosphere` for React 18.2+/19: same components, props, markup and stylesheet.

Initials avatars in four sizes.

`import { EcoAvatar } from "vue-ecosphere"`

## Sizes

Extra small, small, default and large.

Vue (vue-ecosphere):

```vue
<EcoAvatar name="Kim Chen" size="xs" />
<EcoAvatar name="Kim Chen" size="sm" />
<EcoAvatar name="Felipe Alfaro" />
<EcoAvatar name="Felipe Alfaro" size="lg" />
```

React (react-ecosphere):

```tsx
<EcoAvatar name="Kim Chen" size="xs" />
<EcoAvatar name="Kim Chen" size="sm" />
<EcoAvatar name="Felipe Alfaro" />
<EcoAvatar name="Felipe Alfaro" size="lg" />
```

## Initials

Word initials, not the first two letters: Alex Jordan is AJ, Analytics warehouse AW. A decorative avatar beside a name already on screen is aria-hidden; one that is itself a control needs a label.

Vue (vue-ecosphere):

```vue
<EcoAvatar name="Alex Jordan" />          <!-- AJ -->
<EcoAvatar name="Analytics warehouse" />  <!-- AW -->
```

React (react-ecosphere):

```tsx
<EcoAvatar name="Alex Jordan" />          {/* AJ */}
<EcoAvatar name="Analytics warehouse" />  {/* AW */}
```

## API

Vue (vue-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `name` | `string` | — | Full name. Initials come from its first and last words; the default slot overrides them. |
| `size` | `"xs" \| "sm" \| "md" \| "lg"` | "md" | Four sizes; md is the 36px default. |
| `src` | `string` | — | Photo URL, shown instead of the initials. |
| `label` | `string` | — | Accessible name. Omit when the name is already on screen (the avatar is then aria-hidden). |

React (react-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `name` | `string` | — | Full name. Initials come from its first and last words; children override them. |
| `size` | `"xs" \| "sm" \| "md" \| "lg"` | "md" | Four sizes; md is the 36px default. |
| `src` | `string` | — | Photo URL, shown instead of the initials. |
| `label` | `string` | — | Accessible name. Omit when the name is already on screen (the avatar is then aria-hidden). |
