# <avatar>

A round avatar from a photo, initials or an icon, in any size and color.

Category: Display.

```ham
<row style="gap-12 items-center">
    <avatar text="LM"
            size="56"
            color="indigo"/>
    <avatar text="AR"
            size="56"
            color="teal"/>
    <avatar icon="pets"
            size="56"
            color="orange"/>
    <avatar size="56"/>
</row>
```

How Hype Apps draws it on a phone: [light](https://hypeapps.dev/img/tags/avatar-light.webp), [dark](https://hypeapps.dev/img/tags/avatar-dark.webp).

## Attributes

| Name | What it does | Default |
|---|---|---|
| `color` | Background color |  |
| `icon` | Icon name |  |
| `size` | Avatar diameter | `40` |
| `src` | The picture: anything <img src> takes (https://, a base-relative /path, file:/, media:, a device path). |  |
| `text` | Initials text |  |
| `text-color` | Text/icon color | `white` |

Any tag also takes gestures: `@on.tap`, `@on.longpress`, `@on.doubletap` and `@on.swipeleft` (and right, up and down). `@click` runs on a tap too.

## Guides and recipes that use it

- [Your first screen](https://hypeapps.dev/docs/guides/first-screen.md)
- [Navigation](https://hypeapps.dev/docs/guides/navigation.md)
- [Lists and loops](https://hypeapps.dev/docs/guides/lists.md)
- [A poll that syncs](https://hypeapps.dev/docs/guides/sync.md)
- [Who's using the app ($me)](https://hypeapps.dev/docs/guides/me.md)
- [A cart with quantities](https://hypeapps.dev/docs/cookbook/cart.md)
- [A chat thread](https://hypeapps.dev/docs/cookbook/chat.md)

## Related tags

- [`<row>`](https://hypeapps.dev/docs/reference/row.md): Lays children side by side in one line; flex= shares the free space and align/cross position them.
- [`<ad>`](https://hypeapps.dev/docs/reference/ad.md): An ad slot in the page, filled with a banner from AdMob in a built app.
- [`<badge>`](https://hypeapps.dev/docs/reference/badge.md): A small count or dot pinned to the corner of an icon or any other element.
- [`<canvas-tool>`](https://hypeapps.dev/docs/reference/canvas-tool.md): A drawing tool written in HAM and loaded into a draw pad as a plugin: touch handlers, state and options.
- [`<caption>`](https://hypeapps.dev/docs/reference/caption.md): A table caption, shown as a label above the table.
- [`<carousel>`](https://hypeapps.dev/docs/reference/carousel.md): Swipeable pages side by side, one at a time, with dots below that show which page is on screen.
- [`<chart>`](https://hypeapps.dev/docs/reference/chart.md): A line, area, bar or sparkline chart drawn from a list of values; a tap shows a point's value.
- [`<countdown>`](https://hypeapps.dev/docs/reference/countdown.md): A timer that counts down to zero in a format you choose and can act when it gets there.

All tags: https://hypeapps.dev/docs/reference.md · The full reference: https://hypeapps.dev/llms.txt
