# Avatar · MIAN

An image, initials or icon representing a person or entity. Sizes, shapes, presence and stacked groups.

- Id: `avatar` · Category: Data display · Needs mian.js: no · License: MIAN License (free to use)
- Docs: https://mian.ro/components/avatar
- Use for: user picture, initials, profile image, avatar group, presence dot.

Use only the classes below and copy the examples' structure and ARIA; change the words. Check your markup at https://mian.ro/api/v1/validate.

## Install

```html
<link rel="stylesheet" href="https://mian.ro/dist/mian.css">
```

## Classes

- `mn-avatar`: Base.
- `mn-avatar-xs · sm · lg · xl`: Sizes.
- `mn-avatar-square`: Rounded square.
- `mn-avatar-group`: Overlapping stack.
- `mn-avatar-wrap + mn-presence`: Status dot: mn-online, mn-busy, mn-away.

## Accessibility

- Give images meaningful alt text, or alt="" when the name is printed next to it.
- Presence dots are visual: include the status in text or a label.

## Examples

### Images and initials

```html
<span class="mn-avatar"><img alt="Ana Popescu" src="data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2064%2064'%3E%3Crect%20width%3D'64'%20height%3D'64'%20fill%3D'hsl(330%2055%25%2078%25)'%2F%3E%3Ccircle%20cx%3D'32'%20cy%3D'26'%20r%3D'12'%20fill%3D'hsl(330%2035%25%2042%25)'%2F%3E%3Cpath%20d%3D'M10%2064c2-14%2011-21%2022-21s20%207%2022%2021z'%20fill%3D'hsl(330%2035%25%2042%25)'%2F%3E%3C%2Fsvg%3E"></span>
<span class="mn-avatar"><img alt="Kenji Sato" src="data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2064%2064'%3E%3Crect%20width%3D'64'%20height%3D'64'%20fill%3D'hsl(200%2055%25%2078%25)'%2F%3E%3Ccircle%20cx%3D'32'%20cy%3D'26'%20r%3D'12'%20fill%3D'hsl(200%2035%25%2042%25)'%2F%3E%3Cpath%20d%3D'M10%2064c2-14%2011-21%2022-21s20%207%2022%2021z'%20fill%3D'hsl(200%2035%25%2042%25)'%2F%3E%3C%2Fsvg%3E"></span>
<span class="mn-avatar" aria-label="Linh Tran">LT</span>
<span class="mn-avatar mn-primary" aria-label="Radu Butnaru">RB</span>
<span class="mn-avatar mn-avatar-square"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/></svg></span>
```

### Sizes

```html
<span class="mn-avatar mn-avatar-xs">XS</span>
<span class="mn-avatar mn-avatar-sm">SM</span>
<span class="mn-avatar">MD</span>
<span class="mn-avatar mn-avatar-lg">LG</span>
<span class="mn-avatar mn-avatar-xl">XL</span>
```

### Presence and group

```html
<span class="mn-avatar-wrap"><span class="mn-avatar"><img alt="Mira" src="data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2064%2064'%3E%3Crect%20width%3D'64'%20height%3D'64'%20fill%3D'hsl(40%2055%25%2078%25)'%2F%3E%3Ccircle%20cx%3D'32'%20cy%3D'26'%20r%3D'12'%20fill%3D'hsl(40%2035%25%2042%25)'%2F%3E%3Cpath%20d%3D'M10%2064c2-14%2011-21%2022-21s20%207%2022%2021z'%20fill%3D'hsl(40%2035%25%2042%25)'%2F%3E%3C%2Fsvg%3E"></span><span class="mn-presence mn-online" aria-label="Online" role="img"></span></span>
<span class="mn-avatar-wrap"><span class="mn-avatar"><img alt="Ion" src="data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2064%2064'%3E%3Crect%20width%3D'64'%20height%3D'64'%20fill%3D'hsl(18%2055%25%2078%25)'%2F%3E%3Ccircle%20cx%3D'32'%20cy%3D'26'%20r%3D'12'%20fill%3D'hsl(18%2035%25%2042%25)'%2F%3E%3Cpath%20d%3D'M10%2064c2-14%2011-21%2022-21s20%207%2022%2021z'%20fill%3D'hsl(18%2035%25%2042%25)'%2F%3E%3C%2Fsvg%3E"></span><span class="mn-presence mn-busy" aria-label="Busy" role="img"></span></span>
<div class="mn-avatar-group" aria-label="4 collaborators">
  <span class="mn-avatar"><img alt="A" src="data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2064%2064'%3E%3Crect%20width%3D'64'%20height%3D'64'%20fill%3D'hsl(200%2055%25%2078%25)'%2F%3E%3Ccircle%20cx%3D'32'%20cy%3D'26'%20r%3D'12'%20fill%3D'hsl(200%2035%25%2042%25)'%2F%3E%3Cpath%20d%3D'M10%2064c2-14%2011-21%2022-21s20%207%2022%2021z'%20fill%3D'hsl(200%2035%25%2042%25)'%2F%3E%3C%2Fsvg%3E"></span> <span class="mn-avatar"><img alt="B" src="data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2064%2064'%3E%3Crect%20width%3D'64'%20height%3D'64'%20fill%3D'hsl(145%2055%25%2078%25)'%2F%3E%3Ccircle%20cx%3D'32'%20cy%3D'26'%20r%3D'12'%20fill%3D'hsl(145%2035%25%2042%25)'%2F%3E%3Cpath%20d%3D'M10%2064c2-14%2011-21%2022-21s20%207%2022%2021z'%20fill%3D'hsl(145%2035%25%2042%25)'%2F%3E%3C%2Fsvg%3E"></span> <span class="mn-avatar"><img alt="C" src="data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2064%2064'%3E%3Crect%20width%3D'64'%20height%3D'64'%20fill%3D'hsl(265%2055%25%2078%25)'%2F%3E%3Ccircle%20cx%3D'32'%20cy%3D'26'%20r%3D'12'%20fill%3D'hsl(265%2035%25%2042%25)'%2F%3E%3Cpath%20d%3D'M10%2064c2-14%2011-21%2022-21s20%207%2022%2021z'%20fill%3D'hsl(265%2035%25%2042%25)'%2F%3E%3C%2Fsvg%3E"></span>
  <span class="mn-avatar">+9</span>
</div>
```

## Source

Already inside mian.css; you do not need it to use the component. To vendor or customise: https://mian.ro/api/v1/components/avatar/source
