SwipeRow
A row whose actions slide out when it is swiped left, such as Archive and Delete on a message, with a More button that shows them without a swipe.
Stability: experimental
Props
| Prop | Type | Default | Means |
|---|---|---|---|
label | string | What the row is; the group's accessible name, and the More button is named "Actions for <label>". | |
actions | { id: string; label: string; destructive?: boolean }[] | The actions behind the row, in order; a destructive one is filled with the danger colour. | |
open | boolean | bindable(false) | Whether the actions show. Bind it with bind:open={name}. |
onAction | (id: string) => void | Called with an action's id when it is chosen; the actions are put away first. |
Children
The row's content, such as a title and a line of text.
States
| State | Looks like |
|---|---|
closed | The content and a More button at the end. |
open | The actions slide in from the end, between the content and the More button. |
Accessibility
| role | group named by the label prop |
| name | The label prop. Each action is a button named by its label. |
| focus | Tab reaches the row's own controls, then More, and when open each action before More. |
| keyboard | Enter and Space press More, which shows or hides the actions (aria-expanded), and press an action. |
| notes | A swipe left opens it and a swipe right closes it; the swipe is never the only way, since More does the same. Right-to-left layouts are not mirrored yet. |
Theme tokens
color.surface color.primary color.on-primary color.danger color.muted space.2 space.3 space.4 text.label
Example
<SwipeRow label="Lunch with Sam" actions={[{ id: "archive", label: "Archive" }]} onAction={act}><text>Lunch with Sam</text></SwipeRow>