Swipeable List
Swipeable List associates left and right action sets with stable item IDs.
Practical React example
Reveal secondary actions on a record row while keeping the primary record content readable.
Before you copy and paste
Keep the example in the React rendering environment required by the imported component. Copy components/motion/swipeable-list.tsx and its returned support files from the Code tab; preserve the project-relative paths.
Listed package dependencies: clsx, lucide-react, motion, react, tailwind-merge.
Use the Code tab for the component files and installation instructions, then adapt the imports in this example to your project.
Reveal secondary actions on a record row while keeping the primary record content readable
// Usage adapted from beUI's pinned MIT source.
// Copyright (c) 2026 Saurabh Chauhan. See ./LICENSES.md.
"use client";
import {
Check,
Clock3,
FileText,
Flag,
Mail,
Pin,
RotateCcw,
Trash2,
UserRound,
} from "lucide-react";
import { useState } from "react";
import {
type SwipeAction,
SwipeableList,
type SwipeableListItem,
} from "@/components/motion/swipeable-list";
const leftActions: SwipeAction[] = [
{
id: "done",
label: "Done",
icon: <Check className="h-4 w-4" />,
tone: "success",
},
{
id: "pin",
label: "Pin",
icon: <Pin className="h-4 w-4" />,
tone: "primary",
},
];
const rightActions: SwipeAction[] = [
{
id: "later",
label: "Later",
icon: <Clock3 className="h-4 w-4" />,
tone: "warning",
},
{
id: "trash",
label: "Trash",
icon: <Trash2 className="h-4 w-4" />,
tone: "danger",
},
];
const initialItems: SwipeableListItem[] = [
{
id: "brief",
title: "Launch brief",
description: "Finalize the announcement copy",
meta: "9:41",
leading: (
<div className="grid h-10 w-10 place-items-center rounded-xl border border-border bg-background text-muted-foreground">
<FileText className="h-4 w-4" />
</div>
),
leftActions,
rightActions,
},
{
id: "feedback",
title: "Client feedback",
description: "Three comments need a response",
meta: "11:08",
leading: (
<div className="grid h-10 w-10 place-items-center rounded-xl border border-border bg-background text-muted-foreground">
<Mail className="h-4 w-4" />
</div>
),
leftActions,
rightActions,
},
{
id: "review",
title: "Design review",
description: "Check spacing before handoff",
meta: "13:20",
leading: (
<div className="grid h-10 w-10 place-items-center rounded-xl border border-border bg-background text-muted-foreground">
<UserRound className="h-4 w-4" />
</div>
),
leftActions,
rightActions,
},
{
id: "incident",
title: "Flagged run",
description: "Retry queue has one failed job",
meta: "Now",
leading: (
<div className="grid h-10 w-10 place-items-center rounded-xl border border-border bg-background text-muted-foreground">
<Flag className="h-4 w-4" />
</div>
),
leftActions,
rightActions,
},
];
export function SwipeableListPreview() {
const [items, setItems] = useState(initialItems);
const [lastAction, setLastAction] = useState("Ready");
return (
<div className="flex min-h-96 w-full items-center justify-center">
<div className="w-full max-w-sm rounded-[2rem] border border-border bg-background p-3 shadow-2xl">
<div className="mb-3 flex items-center justify-between px-1">
<div>
<p className="text-sm font-semibold text-foreground">Priority queue</p>
<p className="text-xs text-muted-foreground">{lastAction}</p>
</div>
<button
type="button"
onClick={() => {
setItems(initialItems);
setLastAction("Queue restored");
}}
className="inline-flex h-8 items-center gap-1.5 rounded-full border border-border px-3 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground"
>
<RotateCcw className="h-3.5 w-3.5" />
Reset
</button>
</div>
<SwipeableList
items={items}
onAction={({ item, action }) => {
setLastAction(`${action.label} · ${item.title}`);
if (action.id === "trash") {
setItems((current) => current.filter((entry) => entry.id !== item.id));
}
}}
/>
<div className="mt-3 flex items-center justify-between px-1 text-[11px] font-medium text-muted-foreground">
<span>{items.length} open</span>
<span>Today</span>
</div>
</div>
</div>
);
}
Usage example adapted from beUI's pinned MIT source. Retain the source licence notices when copying.
Connect onAction to your record-command layer and decide when the revealed rail closes. Use clear action labels and visible alternatives for critical operations.
Customization
- SwipeableListProps.items
- Required; SwipeableListItem[].
- SwipeableListProps.value
- Optional; SwipeableListValue | null.
- SwipeableListProps.defaultValue
- Optional; SwipeableListValue | null.
- SwipeableListProps.onValueChange
- Optional; (value: SwipeableListValue | null) => void.
- SwipeableListProps.onAction
- Optional; (payload: { item: SwipeableListItem; action: SwipeAction; side: SwipeSide; }) => void.
- SwipeableListProps.actionWidth
- Optional; number.
- SwipeableListProps.revealThreshold
- Optional; number.
- SwipeableListProps.closeOnAction
- Optional; boolean.
- SwipeableListProps.className
- Optional; string.
- SwipeableListProps.classNames
- Optional; SwipeableListClassNames.
- SwipeableListProps.renderItem
- Optional; (item: SwipeableListItem) => ReactNode.
Integration notes
- A swipe gesture is not authorization to delete or archive a record.
- Test scroll-versus-swipe behavior, keyboard access and recovery after a rejected optimistic change.
Component source: beUI documentation . These examples describe the version imported into Rendyn. Upstream APIs may have changed; retain the source licence notices when adapting the code.
Give your agent taste.
The best way to use Rendyn is through MCP. Let your agent find the right component, compare previews and bring the source into your project.
All components are free. Sign up only to connect MCP.