1. Reference
  2. Display

<avatar>

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

Display
avatar.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>
The snippet drawn by Hype Apps on a phone, in light mode The snippet drawn by Hype Apps on a phone, in dark mode
This snippet as Hype Apps draws it on a phone. It follows this page's light or dark theme.

Attributes

NameWhat it doesDefault
color Background color
color
icon Icon name
string
size Avatar diameter
number
40
src The picture: anything <img src> takes (https://, a base-relative /path, file:/, media:, a device path).
string
text Initials text
string
text-color Text/icon color
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

This page is also Markdown, and all of HAM is in llms.txt.