Swipe to Delete
A short swipe settles open on the actions, a long one grows the main action across the row and runs it on release. Every row also has a More button for keyboard and mouse users.
The decision inside it
Never swipe-only
A More button on every row opens the same actions, and they are real buttons in the tab order only while showing.
When to use it
Use SwipeRow in a list people manage on a phone (an inbox, notifications, a queue) for quick actions like archive and delete. Every row also gets a More button, so it works without swiping.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Layro's Swipe to Delete for this.
Install it: npx shadcn@latest add @layro/swipe-to-delete
(the @layro registry is set up in components.json, with LAYRO_KEY in .env.local)
Import it from @/components/ui/swipe-to-delete.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @layro registry with your CLI token: see the Namespaced tab.
Usage
import { Archive, Trash2 } from "lucide-react";
import { SwipeRow } from "@/components/ui/swipe-to-delete";
export function InboxRow({ title, archive, remove }: { title: string; archive: () => void; remove: () => void }) {
return (
<SwipeRow
fullSwipeAction={1}
actions={[
{ label: "Archive", icon: <Archive />, onAction: archive },
{ label: "Delete", icon: <Trash2 />, tone: "destructive", onAction: remove },
]}
>
<div className="px-4 py-3">{title}</div>
</SwipeRow>
);
}API reference
“Copy prompt” above puts a full brief on your clipboard — install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Prop | Type | Notes |
|---|---|---|
childrenrequired | React.ReactNode | — |
actionsrequired | SwipeAction[] | One to three actions, nearest the content first. |
side | "left" | "right" | Which side the actions sit on. "right" means swipe left to see them. Default "right". |
threshold | number | Share of the row's width (0 to 1) past which a full swipe runs the action. Default 0.6. |
fullSwipeAction | number | Index in `actions` that a full swipe runs. Leave out for no full swipe. |
actionWidth | number | Width of each action, in pixels. Default 76. |
open | boolean | — |
onOpenChange | (open: boolean) => void | — |
Dependencies
npm packages
clsxframer-motionlucide-reacttailwind-mergeLayro foundations, installed alongside it
layro-themeStates
All of them are drawn by the component. None is left for you to design.
- Rest
- Open
- Armed for full swipe
- Left side
- Keyboard
Accessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances
Lifetime access
Every component, and everything we ship next.
- All 232 components, source included
- Every template, and everything released after you buy
- shadcn CLI or download — React 18/19, Tailwind v4
- One payment. No subscription.