Swipe actions

A React component in Beamline's Actions category, in the free sample.

Row actions behind a swipe on touch screens and a two-finger swipe on a trackpad, and at the row's end for pointer and keyboard (a ⋯ menu in a narrow row, icon buttons in a wide one); a full swipe runs the edge action.

Use it for

  • Row actions in lists people work through: archive, delete, flag, on a phone and at a desk alike.

Not for

Anatomy

  • row (size container, host of the waiting actions)
  • face (the content, a surface that slides)
  • leading actions
  • trailing actions (the first is the full-swipe action)
  • end of the row: ⋯ menu (narrow) or icon buttons with tooltips (from 32rem, up to 3 actions)

Variants

  • tone: danger, accent, neutral, success

States

  • closed
  • dragging
  • open start
  • open end
  • armed (a full swipe will run the edge action; it takes the whole side)
  • full swipe

Keyboard

  • Tab reaches the row's end: the ⋯ menu, or the icon buttons in a wide row (shown while focus is in the row)
  • Every action is in the menu or the icon buttons; the swiped panels are for touch and stay out of the Tab order while closed

Motion

Follows a finger or a trackpad 1:1 and resists past the actions; the actions come out with the row's edge (the side is as wide as the face has moved), each icon growing in over the first slot of travel. Past 60% of the row the edge action is armed: it takes the whole side, its icon swells and a phone ticks. Released, it settles on --pui-ease-drawer over --pui-duration-considered; a closed side is unseen and inert. The waiting actions arrive at once on hover or focus and leave over --pui-motion-out; on touch they show. Works in both reading directions.

Props

PropTypeDefaultDescription
labelstring—What the row is, for the menu's name: "Invoice INV-0412".
leading / trailing{ id, label, icon, tone?, onAction }[]—leading: Revealed by swiping right (from the start edge). trailing: Revealed by swiping left (from the end edge). The first one is the full-swipe action.
childrenReactNode—The row's content.
style / refCSSProperties / native Ref—style: Inline styles on the documented visual root; no inline overrides by default. ref: Receives the documented root element; no ref by default.
classNamesSwipeActionsClassNames—Classes for the named visual parts; no part overrides by default.
trailingSwipeAction[]—Revealed by swiping left (from the end edge). The first one is the full-swipe action.
leadingSwipeAction[]—Revealed by swiping right (from the start edge).
styleCSSProperties—Inline styles on the documented visual root; no inline overrides by default.
refRef<HTMLDivElement>—Receives the documented root element; no ref by default.
classNamestring—Classes on the documented visual root; no override by default.

Built from

Dependencies

lucide-react

Import

import { SwipeActions } from "@beamline/swipe-actions";

Get it

Swipe actions is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Swipe actions is included in the free MIT sample. Get Beamline · Connect your agent

More in Actions

  • Consequence preview: A risky action that shows what it will do before it runs: one headline sentence, what blocks it and what it also reaches as bands, then the rest as cards…
  • Theme switch: The light/dark control: the page changes in one of four transitions starting from the button (reveal, eclipse, split, rise), and the icon turns between…
  • Confirm morph: A destructive action that asks in place: the button morphs into its question, then into working, then into the result with Undo or Retry, without a dialog.
  • Hold to confirm: Confirms a costly action by holding instead of clicking: a fill sweeps across while held and drains if let go early; pointer, touch, Space and Enter all…
  • Split button: One obvious action joined to a menu of close alternatives; both halves are real buttons and the menu uses the shared menu rows.
  • Copy button: Copies a value and confirms in place: the icon becomes a check and the label says Copied; a refused copy says so instead of pretending.
  • Button: The action control: five weights and a brand fill, a buy/sell tone, sm/md/lg and a 44 px touch size, icon-only, a loading state that keeps its size and…

Part of Beamline UI: polished, editable React components and complete screens for custom applications. Build your own style from any look; tokens, fonts, radii, motion; not only colours.