Duolith docs

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

PropTypeDefaultMeans
labelstringWhat 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.
openbooleanbindable(false)Whether the actions show. Bind it with bind:open={name}.
onAction(id: string) => voidCalled 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

StateLooks like
closedThe content and a More button at the end.
openThe actions slide in from the end, between the content and the More button.

Accessibility

rolegroup named by the label prop
nameThe label prop. Each action is a button named by its label.
focusTab reaches the row's own controls, then More, and when open each action before More.
keyboardEnter and Space press More, which shows or hides the actions (aria-expanded), and press an action.
notesA 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>