Skip to content
Sign upPro
ShellSwipe actionsMenu

Swipe actions (Pro)

ProIncluded in $99

Swipe a message or a thread for retry, copy, pin or delete, with a commit line for a long swipe and a small bump when you cross it.

ProSwipe a chat left to archive or delete (keep going to delete), right to pin.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/swipe-actions

Needs chatcn Pro

This command works with a Pro license, along with every Pro component.

Or start free: sign up and get three Pro components on us, with a new one every month.

Usage

tsx
import { SwipeActions } from "@/components/ui/chatcn/pro/swipe-actions"

<SwipeActions
  leading={[{ id: "pin", label: "Pin", icon: <PinIcon />, tone: "amber", onAction: pin }]}
  trailing={[
    { id: "archive", label: "Archive", icon: <ArchiveIcon />, onAction: archive },
    { id: "delete", label: "Delete", icon: <TrashIcon />, tone: "red", onAction: remove },  // a long swipe runs this one
  ]}
>
  <ThreadRow thread={thread} />
</SwipeActions>

The row follows the finger and the actions slide out from under it, spreading as it goes. Let go past half of the actions' width, or flick, and it rests open; tap the row to close it. Keep going past the commit line (60% of the row) and the outer action takes the whole strip, its icon gives a small bump and the device vibrates briefly where it can; let go and the row slides away, the action runs and the row comes back. Everything moves on one critically damped spring driven frame by frame, so a new touch catches the row mid flight. Only a clearly sideways move starts a swipe, so lists still scroll. One row is open at a time. For keyboards, a menu button with the same actions appears when the row is tabbed into. Physical directions follow right to left layouts.

Examples

States

ProOn messages at phone width: reply on one side, copy and retry on the other.

Props

PropTypeNotes
leadingSwipeAction[]The start side; the first is what a long swipe runs
trailingSwipeAction[]The end side; the last is what a long swipe runs
menubooleanThe keyboard menu. Default true
disabledbooleanNo swiping
labels{ more }The menu button's name

Keyboard

KeyAction
TabShows the actions menu button for the row
EnterOpens the menu

Accessibility

  • The swipe strip is decoration; the same actions are real menu items for keyboards and screen readers.
  • Name the menu button per row through labels.more.
  • Colors follow the kit's meanings: red for delete, amber for pin, never color alone.

Motion

A critically damped spring, about 350 ms to rest, carrying the release velocity. Under reduced motion rows jump to rest and nothing vibrates.