Skip to content
Fleetline

Action sheet

Usage

Use an action sheet on a phone or tablet when a mechanic picks one action for one item: a work order's Mark done, Reassign, Print. It opens from the item's More actions button or from a long press.

Content: verb + object ("Reassign mechanic", "Delete work order"). The title is the item's name when the trigger doesn't say it. Cancel is always the last row.

Anatomy

  1. Backdrop — ::backdrop with --color-bg-overlay
  2. Container — <dialog class="action-sheet"> on the overlay surface, bottom edge on phones
  3. Header (optional) — .action-sheet__title and .action-sheet__message
  4. Actions — .action-sheet__item buttons, --danger for destructive ones (last)
  5. Cancel — after .action-sheet__separator, closes without acting

Examples

Open sheets are previewed in the page with the docs-only .is-preview class; every demo also has a real trigger that opens it in the top layer with commandfor/command="show-modal", without JavaScript.

Action sheet


Open: anchored to the bottom on phones (resize below 40rem), a centered card on wider screens.

WO-4182

Brake inspection · Van KX-219 · Northside Depot


A title and message name the item the actions apply to when the trigger doesn't.

WO-4182


The destructive action is last, in danger text, and never focused first: focus starts on Cancel.

<button type="button" class="icon-btn" commandfor="wo-actions" command="show-modal" aria-label="More actions for WO-4182">…</button>

<dialog id="wo-actions" class="action-sheet" aria-labelledby="wo-actions-title" closedby="any">
  <div class="action-sheet__header"><h2 class="action-sheet__title" id="wo-actions-title">WO-4182</h2></div>
  <button type="button" class="action-sheet__item" commandfor="wo-actions" command="close">Duplicate</button>
  <button type="button" class="action-sheet__item action-sheet__item--danger" commandfor="wo-actions" command="close">Delete work order</button>
  <hr class="action-sheet__separator">
  <button type="button" class="action-sheet__item action-sheet__cancel" commandfor="wo-actions" command="close" autofocus>Cancel</button>
</dialog>

API

HookValuesPurpose
<dialog class="action-sheet">blockThe sheet; open with command="show-modal"
.action-sheet__item (+ --danger)partOne action; each closes the sheet with command="close"
.action-sheet__header | __title | __message | __separator | __cancelpartsSee anatomy
closedby="any"attributeBackdrop tap closes it (no data is lost)
autofocusattributeOn Cancel when a destructive action is present
.is-previewdocs-only classRender an open sheet in the page flow

Do and don't

"Delete work order" last, in danger text, with focus starting on Cancel.

Do keep the destructive action last and out of the initial focus.

A sheet with "Settings", "Dark mode" and "Help".

Don't use an action sheet for navigation or toggles; that's a menu.

Accessibility

Keyboard interaction
KeyBehavior
Tab / Shift+TabMoves between the actions and Cancel; the page behind is inert
Enter / SpaceRuns the focused action and closes the sheet
EscCloses without acting (same as Cancel)

Tokens

Custom propertyPurpose
--color-elevation-surface-overlaySheet surface
--overlay-radius, --overlay-shadowCorners and elevation
--color-bg-overlayBackdrop scrim
--color-feedback-danger-fgDestructive action text
--color-border-subtleSeparator above Cancel
--size-touch-targetRow height
--motion-duration-base | -fast, --motion-easing-enter | -exitSlide in and out

WO-4182

Brake inspection · Van KX-219 · Northside Depot


WO-4182