Swipe Action
A list row that slides sideways to reveal actions behind it, as in a mail or task list on a phone.
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
open | SwipeActionOpen | — | The side whose actions are shown: start, end, or '' for closed. Swiping, tapping and focus change it. |
disabled | boolean | false | Stops the row from moving. An open row closes. |
full-swipe | boolean | false | Lets a long swipe, past 60% of the row's width, trigger the outermost action of that side on release. |
Slots
| Name | Description |
|---|---|
default | The row's content. |
start | Actions revealed at the start edge (the left in left-to-right) by dragging the row toward the end edge. |
end | Actions revealed at the end edge (the right in left-to-right) by dragging the row toward the start edge. |
Events
| Name | Type | Description |
|---|---|---|
open-change | CustomEvent<{ open: '' | 'start' | 'end' }> | A swipe, tap, Escape, focus or an action opened or closed the row. detail.open is the side now open, or ''. Not fired when open is set from code. Does not bubble. |
full-swipe | CustomEvent<{ side: 'start' | 'end' }> | A full swipe was released (with full-swipe set). Cancel it to keep the outermost action from being clicked; the row closes either way. Does not bubble. |
CSS parts
Shadow DOM styling hooks used with ::part(name). Prefer CSS custom properties when they cover the change.
| Name | Description |
|---|---|
content | The sliding box around the default slot. |
start | The box that holds the start actions. |
end | The box that holds the end actions. |
CSS custom properties
Grouped by semantic target and state from --c2-<component>__<target>__<state>--<property>. Click a group to collapse it; click a name to copy it.
| Name | Type | Default | Description |
|---|---|---|---|
--c2-swipe-action__container--background | color | #f4f4f5 | Shown behind the actions where they do not fill the revealed area. |
--c2-swipe-action__container--border-radius | border-radius | 0px | |
--c2-swipe-action__container--border | border | none | |
--c2-swipe-action__content--background | color | #ffffff | Must be opaque: it covers the actions while the row is closed. |
--c2-swipe-action__content--color | color | #18181b | |
--c2-swipe-action__content--padding | padding | 12px 16px | |
--c2-swipe-action__content--min-height | pixel | 48px | |
--c2-swipe-action__content--transition-duration | time | 200ms | How long the row takes to settle after a release or an open change. |
--c2-swipe-action__content--transition-timing-function | string | cubic-bezier(0.2, 0, 0, 1) | |
--c2-swipe-action__content__open--box-shadow | box-shadow | 0 0 12px rgba(24, 24, 27, 0.12) | Shadow under the content while it is moved, which lifts it off the actions. |
--c2-swipe-action__actions--gap | pixel | 8px | Space between the actions of one side. |
--c2-swipe-action__actions--padding | padding | 0 8px | Room around the actions of each side. 0 with --c2-swipe-action__actions--align-items: stretch makes full-bleed action blocks. |
--c2-swipe-action__actions--align-items | align-items | center | center keeps buttons at their own height; stretch makes them as tall as the row. |