1. Reference
  2. Display

<badge>

A small count or dot pinned to the corner of an icon or any other element.

Display
badge.ham
<row style="gap-32 items-center">
    <badge count="3">
        <icon name="mail size-28"/>
    </badge>
    <badge count="12"
           color="teal">
        <icon name="shopping_cart size-28"/>
    </badge>
    <badge>
        <icon name="notifications size-28"/>
    </badge>
</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 Badge background color
color
red
count Badge label/count text. A count of 0 hides the badge unless show-zero.
string
show-zero Keep the badge (showing 0) when the count is 0.
boolean
false
size Badge size
number
18

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.

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