Action Sheet
FreeThe phone's bottom sheet of choices for the thing you just tapped: a WAI-ARIA menu of actions with icons and second lines, destructive and disabled choices, and a separate Cancel. A choice, Cancel, Escape, a tap on the dimmed page and a swipe down all close it, and focus goes back to whatever opened it.
import { SvActionSheetComponent } from '@styloviz/overlays/action-sheet';Demo & usage
Basic usage
Usage example — open the gallery for the full interactive demo.
An interactive demo for this component lives in the gallery.
Open live demoMore examples
From a row's ⋯ button
<button type="button" aria-haspopup="dialog" (click)="open.set(true)" aria-label="More actions for INV-2041">⋯</button> <sv-action-sheet [(open)]="open" title="Invoice INV-2041" [actions]="[ { id: 'share', label: 'Share', icon: 'share' }, { id: 'copy', label: 'Copy link', icon: 'link' }, { id: 'delete', label: 'Delete invoice', icon: 'trash', destructive: true } ]" (actionSelect)="run($event.action.id)" />
A message, second lines and a disabled choice
<sv-action-sheet [(open)]="open" title="Move 3 conversations" description="They keep their labels." [actions]="[ { id: 'inbox', label: 'Inbox', description: 'Where they are now', disabled: true }, { id: 'archive', label: 'Archive', description: 'Out of the inbox, kept for search' } ]" />
A sheet only a choice can close
<sv-action-sheet [(open)]="open" title="Leave this workspace?" [closeOnBackdrop]="false" [swipeToClose]="false" [actions]="[{ id: 'leave', label: 'Leave workspace', destructive: true }]" (closed)="log($event)" />
When to use
A short list of actions on one thing — a row, a message, a photo — on a phone, where a dropdown menu would be a postage stamp under the thumb. Confirming one destructive step on mobile, with the choice within thumb reach. Not for content or forms (use Drawer or Modal), and not for a typed or held confirmation (use Confirm Dialog).
Compare with
- Drawer — Drawer is a panel of any content from any edge. Action Sheet is the bottom sheet for one decision: a short menu of choices and a Cancel, built on the same overlay primitives.
Async states
None — this component has nothing to load, so it has no loading, empty or error state to drive.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| open | boolean (two-way) | false | Whether the sheet is up. Two-way: `[(open)]`. |
| title | string | '' | The heading — usually the thing the actions apply to ("Invoice INV-2041"). |
| description | string | '' | A line under the heading, read as the sheet's description. |
| actions | readonly SvActionSheetAction[] | [] | The choices, top to bottom. |
| cancelLabel | string | '' | The dismiss button's text. |
| showCancel | boolean | true | Show the separate Cancel button under the menu. |
| ariaLabel | string | '' | The sheet's accessible name when it has no `title`. |
| closeOnBackdrop | boolean | true | A tap on the dimmed page closes it. |
| closeOnEscape | boolean | true | Escape closes it. |
| swipeToClose | boolean | true | A swipe down on the sheet's handle or heading closes it (touch and pen). |
| closeOnNavigation | boolean | true | A navigation closes it, once the app provides `provideSvOverlayRouteClose()`. |
| labels | Partial<SvOverlaysLabels> | {} | Per-instance overrides for the package labels. |
Outputs
| Event | Payload type | Description |
|---|---|---|
| actionSelect | SvActionSheetSelection | A choice was made. The sheet closes with reason `'action'` right after. |
| opened | void | The sheet came up. |
| closed | SvActionSheetCloseReason | The sheet went away, and why. |
| openChange | boolean | Emits the new `open` whenever it changes — the output half of `[(open)]`. |
Customization & theming
Each action takes `icon` (an icon-library name the app registers), `description` (a second line), `destructive` and `disabled`. `cancelLabel` renames Cancel ("Keep them"); `showCancel` drops it. `closeOnBackdrop`, `closeOnEscape`, `swipeToClose` and `closeOnNavigation` each turn one way out off. Full width on a phone, a 28 rem card from `sm` up; never taller than 85% of the viewport, the list scrolling inside it. Strings come from the `overlays` labels (`actionSheetName`, `actionSheetCancel`, `actionSheetDestructive`).
Best practices
Do: Title the sheet with the thing the actions apply to ("Invoice INV-2041"), so every choice has its object. Do: Mark irreversible choices `destructive` — the tone changes and a screen reader hears "(destructive)", so the warning is not colour alone. Don't: Don't hide an unavailable action — mark it `disabled` so the user learns it exists; give the reason in its `description`. Tip: `(closed)` says why it closed (`action` · `cancel` · `backdrop` · `escape` · `swipe` · `programmatic`), which is what analytics on a sheet usually want.
Accessibility
A modal `role="dialog"` named by its title (or `ariaLabel`) and described by `description`; the page behind it is made inert while it is open. The choices are a WAI-ARIA `menu` of `menuitem`s with one tab stop: ↑/↓ move and wrap, Home/End jump, a letter jumps to the next choice starting with it, Enter or Space chooses. Focus lands on the first available choice when it opens. Tab moves between the menu and Cancel and never leaves the sheet. Escape closes it. Disabled choices stay focusable with `aria-disabled="true"`, as the menu pattern asks. Every way out — a choice, Cancel, Escape, the scrim, a swipe — returns focus to the opener, or to the nearest thing that survived it. The swipe is an extra: Cancel, the scrim and Escape are the single-pointer and keyboard ways out (WCAG 2.5.7). Under reduced motion the sheet appears and goes without sliding. Aria: `@angular/aria` is not a dependency of the kit, so the menu is the kit's own implementation of the WAI-ARIA menu pattern. Moving it onto `@angular/aria` later changes no input or output.
Feedback on Action Sheet
Spotted a gap in this page, or something that didn't work as described? Comments are GitHub Discussions in the public styloviz/community repo, so posting needs a GitHub account.