# <ad>

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

Category: Display. Also written `<banner-ad>`.

To use it, you also need: an AdMob account.

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

```ham
<column style="gap-12">
    <text style="font-bold">Today's recipes</text>
    <text style="muted">Lemon pasta, 20 minutes</text>
    <ad unit="ca-app-pub-3940256099942544/6300978111"
        size="adaptive"
        placeholder="true"/>
</column>
```

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

## Attributes

| Name | What it does | Default |
|---|---|---|
| `bg` | Native template background. |  |
| `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. |  |
| `cta-bg` | Native template call-to-action background. |  |
| `cta-color` | Native template call-to-action text color. |  |
| `keywords` | Per-slot targeting keywords; merge over the <config ad_*> defaults. |  |
| `max-height` | Ceiling in dp for size="inline". | `300` |
| `non-personalized` | Request non-personalized ads for this slot. |  |
| `placeholder` | true draws a labeled gray box of the slot's minimum size where no ad can load. |  |
| `radius` | Native template corner radius. |  |
| `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. |  |
| `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). |  |

## Readings

| Name | What 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.

## Related tags

- [`<column>`](https://hypeapps.dev/docs/reference/column.md): Stacks its children top to bottom, with a gap between them and an alignment across.
- [`<text>`](https://hypeapps.dev/docs/reference/text.md): A run of text; with @text it shows an expression that updates as its variables change.
- [`<avatar>`](https://hypeapps.dev/docs/reference/avatar.md): A round avatar from a photo, initials or an icon, in any size and color.
- [`<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.

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