Swipe Delete Row

Swipe Delete Row is a copy-paste React component that stops swipe while scrolling deleted row before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/swipe-delete-row
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 2 extra npm packages
  • A11y guidance in docs

StopsSwipe while scrolling deleted row

Was this component page useful?

How do I install Swipe Delete Row?

pnpm dlx shadcn@latest add @bollard/swipe-delete-row

The files land in your project. They're yours to edit.

How do I use Swipe Delete Row in React?

swipe-delete-row-usage.tsx
import { SwipeDeleteRow } from "@/components/ui/swipe-delete-row"

<SwipeDeleteRow
  key={row.id}
  itemLabel={`Invoice #${row.id}`}
  onDelete={() => setRows((current) => current.filter((item) => item.id !== row.id))}
>
  <div className="flex items-baseline justify-between gap-3">
    <p className="truncate text-sm font-medium">{row.client}</p>
    <p className="shrink-0 text-sm tabular-nums">{row.amount}</p>
  </div>
  <p className="text-xs text-muted-foreground">
    #{row.id} · {row.due}
  </p>
</SwipeDeleteRow>

What input mistakes does Swipe Delete Row catch?

  • Swipes that don't cross the threshold
  • Fast flicks that cross it too quickly (minSwipeMs)
  • Vertical scrolls mistaken for swipes
  • Deletes regretted within undoFor

What props does Swipe Delete Row accept?

SwipeDeleteRow props
PropTypeDefault
itemLabel* (required)

Name of the thing in the row, used in labels: "Invoice #1042".

string—
onDelete* (required)

Fires once the undo window closes (or the row unmounts while it's open). Remove the item here.

() => void—
onUndo

Fires when the user undoes a delete.

() => void—
threshold

How far (0 to 1 of the row's width) a swipe must travel before release deletes.

number0.4
minSwipeMs

Swipes that cross the line faster than this (ms from touch-down) are treated as accidental flicks.

number160
undoFor

How long Undo stays available, in milliseconds.

number5000
deleteLabel

Templates: `{item}` is filled in.

string"Delete {item}"
releaseText

Shown when releasing will delete.

string"Release to delete"
deletedText

Shown after the row is deleted.

string"Deleted {item}"
undoLabel

Label of the Undo button.

string"Undo"
tooFastText

Shown when a flick was too fast to count.

string"Too quick. Drag past the line to delete."

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

How is Swipe Delete Row accessible?

  • Trash button with an aria-label naming the item, for keyboard and switch users
  • After a keyboard delete, focus moves to Undo; after undo, back to the trash button
  • Status uses role=status and a polite live region
  • Spring motion respects reduced motion

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • onDelete runs after the undo window, so the item stays in your data until then
  • Undo is in-memory; a navigation commits the delete

What expensive mistakes does Swipe Delete Row stop?

Swipe while scrolling deleted row

Also known as

swipe to delete · swipe actions · list row · mobile list · inbox · gesture · ios style

What dependencies does Swipe Delete Row require?

Swipe Delete Row facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameSwipe Delete Row
Registry identifier@bollard/swipe-delete-row
Install commandnpx shadcn@latest add @bollard/swipe-delete-row
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react, motion
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Swipe Delete Row

How does Swipe Delete Row protect destructive mutations?

Swipe Delete Row prevents swipe while scrolling deleted row. Enforces deliberate friction against Swipes that don't cross the threshold, Fast flicks that cross it too quickly (minSwipeMs), Vertical scrolls mistaken for swipes, Deletes regretted within undoFor. Limitation: authorize swipe-delete-row mutations on the server.

How do I install swipe-delete-row with shadcn?

Run `npx shadcn@latest add @bollard/swipe-delete-row`. Sources added: registry/default/swipe-delete-row/swipe-delete-row.tsx. Package requirements: lucide-react, motion.

What props customize Swipe Delete Row?

Swipe Delete Row accepts `itemLabel`, `onDelete`, `onUndo`, `threshold`, `minSwipeMs`. Configures swipe to delete, swipe actions, list row behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of swipe-delete-row?

onDelete runs after the undo window, so the item stays in your data until then. Undo is in-memory; a navigation commits the delete Server requirement: backend verification for swipe-delete-row.

How does Swipe Delete Row meet accessibility guidelines?

Trash button with an aria-label naming the item, for keyboard and switch users. After a keyboard delete, focus moves to Undo; after undo, back to the trash button. Status uses role=status and a polite live region. Spring motion respects reduced motion. Minimizes errors: swipe deleted by accident, flick deleted list item.

Which components pair with Swipe Delete Row?