ActionSheet
A short list of actions in a sheet from the bottom edge, with a cancel button.
Stability: experimental
Props
| Prop | Type | Default | Means |
title | string | | What the actions are about, above them. |
actions | { id: string; label: string; destructive?: boolean }[] | | The actions, in order; a destructive one is in the danger colour. |
open | boolean | bindable(false) | Whether it shows. Bind it with bind:open={name}, or give it a trigger piece. |
cancel | string | Cancel | The cancel button's label. |
onChoose | (id: string) => void | | Runs with the chosen action's id, after the sheet closes. |
Pieces
| Piece | Means |
trigger | What opens it when pressed, such as a button. |
States
| State | Looks like |
closed | Nothing but the trigger. |
open | A panel of actions over a scrim at the bottom edge, and a separate cancel button. |
Accessibility
| |
| role | dialog |
| name | The title prop, or Actions. |
| focus | Moves into the sheet when it opens, stays inside it, and returns to the trigger when it closes. |
| keyboard | Escape closes it; Enter and Space press an action. |
Theme tokens
color.scrim color.surface color.border color.primary color.danger color.muted space.2 space.3 space.4 text.body text.caption
Example
<ActionSheet title="Photo" actions={[{ id: "delete", label: "Delete", destructive: true }]} bind:open={open} onChoose={run} />