# Avatar

> Source: https://design.nanatec.co.ke/components/avatar/
> A person, shown by their photograph or, when there is none or it fails to load, by their initials on a colour picked from their name — so the same tenant is the same colour on every screen. The colours avoid the status tones, so an avatar is never mistaken for a warning.
> Status: beta
> Since: v0.0.40

Give it a `name` and it is announced as that person; without one it is
decoration and hidden from assistive tech. Put an icon in the slot to show
something other than initials when there is no name.

## Preview

## Sizes

```html
<nana-avatar name="Njeri Wambui" size="xs"></nana-avatar>
<nana-avatar name="Njeri Wambui" size="sm"></nana-avatar>
<nana-avatar name="Njeri Wambui" size="md"></nana-avatar>
<nana-avatar name="Njeri Wambui" size="lg"></nana-avatar>
<nana-avatar name="Njeri Wambui" size="xl"></nana-avatar>
```

## Fallbacks

A photograph that fails to load falls back to initials. With no name the avatar
is decorative and shows whatever is in its slot.

```html
<nana-avatar name="Otieno Ouma" src="https://example.invalid/missing.jpg"></nana-avatar>
<nana-avatar><nana-icon name="user"></nana-icon></nana-avatar>
```

## Installation

```html
<nana-avatar name="Kamau Juma" src="/avatars/kamau.jpg"></nana-avatar>
<nana-avatar name="Wanjiru Otieno" size="lg"></nana-avatar>
```
