1. Reference
  2. Display

<banner-ad>

An ad slot in the page, filled with a banner from AdMob in a built app.

Display

This tag has more than one name. Every spelling is the same tag, so write whichever feels natural. Pick one and every example on this page uses it.

This tag needs a device, so try it on your phone.

To use it, you also need:
  • an AdMob account
banner-ad.ham
<column style="gap-12">
    <text style="font-bold">Today's recipes</text>
    <text style="muted">Lemon pasta, 20 minutes</text>
    <banner-ad unit="ca-app-pub-3940256099942544/6300978111"
               size="adaptive"
               placeholder="true"/>
</column>
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
bg Native template background.
color
collapsible Anchored banner that opens large and collapses to its normal size.
top, bottom
content-url Per-slot content URL; merges over the <config ad_*> defaults.
url
cta-bg Native template call-to-action background.
color
cta-color Native template call-to-action text color.
color
keywords Per-slot targeting keywords; merge over the <config ad_*> defaults.
string
max-height Ceiling in dp for size="inline".
number
300
non-personalized Request non-personalized ads for this slot.
boolean
placeholder true draws a labeled gray box of the slot's minimum size where no ad can load.
boolean
radius Native template corner radius.
number
size Banner size: banner 320×50, large-banner 320×100, medium-rectangle 300×250, full-banner 468×60, leaderboard 728×90, adaptive (anchored, full width), inline (in-feed, creative-chosen height up to max-height).
banner, large-banner, medium-rectangle, full-banner, leaderboard, adaptive, inline
banner
template Native only: small (320×90 min, in-feed rows) or medium (320×320 min, half-page).
small, medium
text-color Native template text color.
color
type banner (default) or native (laid out by template).
banner, native
banner
unit Ad-unit id. Ignored in test mode (Google test inventory is substituted).
string

Readings

NameWhat it does
loaded Whether an ad is loaded.

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.