Skip to content
Sign upGet access
MicrointeractionsSwipe replyMenu

Swipe reply

Swipe a message to reply, with a threshold you can see click.

Drag a message sideways and a reply arrow grows in behind it, its ring filling; at the line it fills blue and ticks forward. Let go past it and the reply opens.

Drag a message sideways and it gives less the further you go; behind it a reply arrow grows in, its ring filling as you pull. At the line the ring fills with colour and the arrow ticks forward. Let go past it and the bubble springs home with a little overshoot and the reply opens; short of it, it just springs home.

Installation

$ pnpm dlx shadcn@latest add https://chatcn.dev/r/swipe-reply.json

Usage

tsx
import { SwipeReply } from "@/components/ui/chatcn/swipe-reply"

<SwipeReply side="start" onReply={() => quote(message)}>
  <Bubble>{message.text}</Bubble>
</SwipeReply>

Props

PropTypeNotes
onReply() => voidPast the line, or Enter or R while focused
side"start" | "end"Theirs swipe right, yours left. Default start
thresholdnumberPx. Default 56

Keyboard

KeyAction
Enter / RReply to the focused message

Accessibility

  • The message is focusable and says how to reply.

Motion

  • A rubber band drag and a slightly underdamped spring home. Vertical drags pass through to scrolling.