# <fab>

A floating action button over the screen's corner, with an icon and an optional label.

Category: Forms and input.

```ham
<screen>
    <app-bar title="Notes"/>
    <main>
        <column style="w-full p-16 gap-8">
            <text style="font-bold">Groceries</text>
            <text style="muted">Oat milk, eggs, sourdough</text>
        </column>
    </main>
    <fab id="new-note"
         icon="edit"
         label="New note"
         color="teal"/>
</screen>
```

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

## Attributes

| Name | What it does | Default |
|---|---|---|
| `color` | Background color |  |
| `elevation` | Shadow elevation | `6` |
| `icon` | Icon name | `add` |
| `icon-color` | Icon/text color | `white` |
| `icon-size` | Explicit icon size override |  |
| `id` | Registry ID (same id replaces, different ids stack) |  |
| `label` | Text label (extended FAB) |  |
| `preview` | Render inline instead of hoisting to Scaffold | `false` |
| `shape` | Button shape (circle, rounded, square, default) | `default` |
| `size` | FAB size, each step bigger: xs 40, sm 48, md 56, lg 72, xl 96, 2xl 112, 3xl 128, 4xl 144 dp. A labeled FAB takes the same height. (xs, sm, md, lg, xl, 2xl, 3xl, 4xl) | `md` |
| `tooltip` | Accessibility tooltip |  |

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

- [`<app-bar>`](https://hypeapps.dev/docs/reference/app-bar.md): The bar at the top of a screen: a title, a leading menu icon, and action icons on the right.
- [`<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.
- [`<button>`](https://hypeapps.dev/docs/reference/button.md): A tappable button that runs an action: a fetch, a navigation or a statement.
- [`<checkbox>`](https://hypeapps.dev/docs/reference/checkbox.md): A checkbox with a label; its state goes into a variable by name.
- [`<chip>`](https://hypeapps.dev/docs/reference/chip.md): A compact chip: a label, a filter that toggles, a single choice in a set, or an action.
- [`<color-picker>`](https://hypeapps.dev/docs/reference/color-picker.md): A color picker: a hue ring round a disc, with swatches; the chosen color goes into a variable.
- [`<data-cell>`](https://hypeapps.dev/docs/reference/data-cell.md): One cell of a data table row.

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