Actions

Mobile action bar

<forma-mobile-action-bar>

Safe-area-aware mobile action region that keeps one to three critical contextual actions reachable at the bottom of a narrow screen.

Authoring tag
<forma-mobile-action-bar>
Category
Actions
Behavior owner
Application / Limen
Canonical source
patterns/mobile-action-bar.html

Purpose

The mobile action bar is a bordered row of native buttons that share the width equally. At 40rem and below it becomes position: sticky at the bottom of its scroll container, so the actions stay reachable while a long form or record scrolls, and its bottom padding grows to respect the device safe-area inset. One button can be marked forma-mobile-action-bar__primary for an inverse (filled) surface. Forma provides presentation only: which actions appear, whether they are legal, keeping the bar from covering a focused field, and any show/hide behavior are application or Limen concerns.

Use when

  • A phone screen has one to three actions that complete or leave the current task (Save, Submit, Cancel) and the content above them is long.
  • The same actions exist elsewhere on wider layouts, and the bar is the narrow-screen recomposition of them.
  • You need safe-area-aware bottom placement without writing layout CSS.

Avoid when

  • There are more than three actions: keep the critical ones here and move the rest to Overflow command disclosure or a Action menu.
  • The bar would be the only path to an essential action on wide layouts; the requirement is that it must not be.
  • The row is navigation between destinations: use Navigation shell or Tabs.
  • The actions belong to a modal task: put them in the Dialog or Flyout action footer.

Behavior to know

  • Children share the row equally (flex: 1 1 0), giving large, even targets.
  • Sticky at the bottom of the scroll container only at 40rem and below; at wider widths it is an ordinary in-flow row.
  • Bottom padding is max(0.75rem, env(safe-area-inset-bottom)), so buttons clear a phone's home indicator.
  • A translucent surface with a backdrop blur separates the bar from content scrolling underneath.

Basic example

The smallest correct markup: the canonical pattern from patterns/mobile-action-bar.html inside its public tag. Copy this first, then adapt labels, names and state.

Canonical

Minimal mobile action bar

Rendered from the canonical pattern file.

Static specimen. Its buttons stand for application actions that the consuming application implements; this script-free documentation does not perform them. Its controls are shown for their markup and appearance and cannot be operated here.

HTML · Minimal mobile action bar Raw HTML for HTML · Minimal mobile action bar
<forma-mobile-action-bar class="forma-component-tag">
<nav class="forma-mobile-action-bar" aria-label="Record actions">
  <button type="button" class="forma-mobile-action-bar__secondary">Cancel</button>
  <button type="button" class="forma-mobile-action-bar__primary">Save changes</button>
</nav>
</forma-mobile-action-bar>

Click or tap the code once to select all of it, then copy.

Examples

Scenario

Single submit action

One primary action that fills the bar. The accessible name of the landmark says which task the action belongs to.

Static specimen. Its buttons stand for application actions that the consuming application implements; this script-free documentation does not perform them. Its controls are shown for their markup and appearance and cannot be operated here.

HTML · Single submit action Raw HTML for HTML · Single submit action
<forma-mobile-action-bar class="forma-component-tag">
  <nav class="forma-mobile-action-bar" aria-label="Expense claim actions">
    <button type="button" class="forma-mobile-action-bar__primary">Submit claim</button>
  </nav>
</forma-mobile-action-bar>

Click or tap the code once to select all of it, then copy.

Scenario

Three actions with long labels

Three equal-width actions: two secondary and one primary. Long labels wrap inside their buttons instead of widening the bar, and every button keeps the 44px minimum height. Order in source is the order users hear and tab through; here the primary comes last.

Static specimen. Its buttons stand for application actions that the consuming application implements; this script-free documentation does not perform them. Its controls are shown for their markup and appearance and cannot be operated here.

HTML · Three actions with long labels Raw HTML for HTML · Three actions with long labels
<forma-mobile-action-bar class="forma-component-tag">
  <nav class="forma-mobile-action-bar" aria-label="Incident report actions">
    <button type="button">Discard</button>
    <button type="button">Save as draft</button>
    <button type="button" class="forma-mobile-action-bar__primary">Submit for review</button>
  </nav>
</forma-mobile-action-bar>

Click or tap the code once to select all of it, then copy.

Mobile

Each mobile example renders in its own document inside a real narrow viewport, so Forma's media and container queries run exactly as they would on a phone. Choose a width to compare.

Mobile example

Sticky under a long form

At phone width the bar sticks to the bottom of the viewport while the form above scrolls. It is the last child of the form, so it stops sticking when the end of the form is reached and never overlaps content after it.

Static specimen. Submitting or resetting it needs the consuming application's form handling, which this documentation does not have. Its controls are shown for their markup and appearance and cannot be operated here.

Viewport width

Frames narrower than the selected width show the component at the width available.

What changes at narrow widths

  • At 40rem (640px) and below the bar is position: sticky; inset-block-end: 0 with a z-index above the content, so it stays visible while its container scrolls.
  • Bottom padding expands to the safe-area inset on devices with a home indicator or rounded corners, in portrait and landscape.
  • Buttons share the width equally and wrap their labels; there is no horizontal scrolling at 320px.
  • A sticky bar can cover the field that has focus near the bottom of the viewport. Add bottom scroll padding or margin to the scroll container in the application so focused fields scroll clear of the bar.
HTML · Sticky under a long form Raw HTML for HTML · Sticky under a long form
<forma-mobile-action-bar class="forma-component-tag">
  <form class="forma-stack" action="#" method="post">
    <div class="forma-field">
      <label class="forma-field__label" for="mobile-action-bar-mobile-sticky-form-name">Full name</label>
      <input id="mobile-action-bar-mobile-sticky-form-name" name="name" type="text" autocomplete="name">
    </div>
    <div class="forma-field">
      <label class="forma-field__label" for="mobile-action-bar-mobile-sticky-form-email">Email</label>
      <input id="mobile-action-bar-mobile-sticky-form-email" name="email" type="email" autocomplete="email">
    </div>
    <div class="forma-field">
      <label class="forma-field__label" for="mobile-action-bar-mobile-sticky-form-notes">Notes for the reviewer</label>
      <textarea id="mobile-action-bar-mobile-sticky-form-notes" name="notes" rows="6"></textarea>
    </div>
    <nav class="forma-mobile-action-bar" aria-label="Profile form actions">
      <button type="reset">Reset</button>
      <button type="submit" class="forma-mobile-action-bar__primary">Save profile</button>
    </nav>
  </form>
</forma-mobile-action-bar>

Click or tap the code once to select all of it, then copy.

Baseline

Mobile · 320px

The canonical pattern in a true 320px viewport, the minimum width every Forma component must support without page-level horizontal scrolling.

Static specimen. Its buttons stand for application actions that the consuming application implements; this script-free documentation does not perform them. Its controls are shown for their markup and appearance and cannot be operated here.

Viewport width

Frames narrower than the selected width show the component at the width available.

API and configuration

Forma components have no JavaScript API. Their public contract is the markup: native elements and attributes you write, and the CSS hooks below. The CSS hook table is generated from the built stylesheet, so it always matches the shipped implementation.

Native and ARIA attributes
AttributeOnValuesDefaultDescription
aria-labelnav.forma-mobile-action-barstring—Names the region after the task ("Record actions"), so it is distinguishable from the site navigation landmark.
typebuttonbutton | submit | reset—Use submit when the bar is the form's action row, button otherwise.
CSS hooks (derived from dist/all.css)
HookKindValues or defaultDescription
.forma-mobile-action-barBlock class—The bar: a flex row with padding, a functional border, a translucent primary surface and a backdrop blur. Sticky at the bottom at 40rem and below.
.forma-mobile-action-bar__primaryElement class—Marks the single most important action with the inverse (filled) surface and inverse text. Other actions need no class; the canonical pattern's forma-mobile-action-bar__secondary has no CSS of its own.
Keyboard interaction
KeysResult
Tab / Shift+TabMoves through the bar's buttons in source order. Sticky positioning does not change focus order.
Enter / SpaceActivates the focused button (native behavior).
Events
EventDescription
click / submitNative button activation and, for submit buttons inside a form, the form's submit event. Forma adds no events.

Form behavior

When the bar sits inside a form, its submit and reset buttons act on that form natively. The bar itself submits nothing.

States

Mobile action bar states
StateHow it is expressedPresentation
In flowviewport wider than 40remAn ordinary bordered row wherever it appears in the source.
Sticky@media (max-width: 40rem)Sticks to the bottom edge of the scroll container while its parent is in view.
Primary actionclass forma-mobile-action-bar__primaryFilled inverse surface for the most important action. In forced-colors mode surface tokens become Canvas, so the primary is not visually distinct there; its label must carry the meaning.
Disabled actiondisabled attribute on a buttonNative disabled button; the application should say why nearby.

Accessibility

Forma provides

  • Keeps every action a native button with its own role, name and keyboard activation.
  • Gives buttons equal width and at least the native 44px height, making large touch targets.
  • Respects the bottom safe-area inset so the home indicator does not overlap the buttons.
  • Does not reorder the buttons visually; source order is reading and focus order.

Your application supplies

  • Give the region an accessible name that differs from other landmarks on the page.
  • Keep the bar from covering a focused field, for example with scroll-padding-block-end on the scroll container.
  • Keep the same actions reachable on wide layouts; the bar is a recomposition, not the only path.
  • Limit the bar to critical actions and make each label self-explanatory without the filled style.

Responsive behavior

  • Above 40rem the bar is static and sits in normal flow; at 40rem and below it becomes sticky at the bottom with z-index 8.
  • Sticky positioning is relative to the nearest scroll container and stops at the end of the bar's parent, so place the bar as the last child of the content it serves.
  • Buttons use flex: 1 1 0, so each gets an equal share of the width and long labels wrap inside the button.
  • The bottom padding uses env(safe-area-inset-bottom) in both orientations; it has no effect on devices without an inset.

Motion

  • No animation: the bar does not slide, fade or hide on scroll. Sticky positioning is scroll-driven layout, not motion. Buttons keep the native button hover and press color feedback. Any hide-on-scroll behavior belongs to the application and must respect reduced motion.

Usage guidance

Do

  • Use at most three actions and mark only one as primary.
  • Place the bar at the end of the form or content it acts on.

Avoid

  • Hiding the same actions elsewhere on desktop so the bar becomes the only way to reach them.
  • Relying on the filled primary surface to signal which action is safe or recommended; the label must say it.
  • Putting navigation links or filters in the bar.

Verification specimens

Generated fault-injection specimens expose content, spacing, color-cue, and reduced-effective-contrast risks. They screen presentation robustness as engineering screens without claiming human-subject validation.