1. Reference
  2. Forms and input

<fab>

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

Forms and input
fab.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>
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
elevation Shadow elevation
number
6
icon Icon name
string
add
icon-color Icon/text color
color
white
icon-size Explicit icon size override
number
id Registry ID (same id replaces, different ids stack)
string
label Text label (extended FAB)
string
preview Render inline instead of hoisting to Scaffold
boolean
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
string

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.