Skip to content
Sign upGet access
MicrointeractionsWord swapMenu

Word swap (Pro)

ProIncluded in $99

An edit suggestion that shows its work: old words are struck word by word and the new ones grow in.

ProStruck words get a line drawn through them and the new words grow in beside them, word by word. Accept folds the old words shut; reject folds the new ones away.

A line is drawn through each word the rewrite drops, hunk by hunk and word by word, like a pen, and the new words grow in beside them one at a time, pushing the sentence open rather than jumping it. Accept, and the struck words fold shut while the new ones settle into plain text. Reject, and the new words fold away and the strikes lift off.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/word-swap

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 { WordSwap } from "@/components/ui/chatcn/pro/word-swap"

<WordSwap text={draft} suggestion={rewrite} state={state} onAccept={() => setState("accepted")} onReject={() => setState("rejected")} />

The diff is by word, computed inside; pass whole sentences or a short paragraph.

Props

PropTypeNotes
text / suggestionstringAs written, and the rewrite
state"pending" | "accepted" | "rejected"Default pending
onAccept / onReject() => voidShow the buttons

Accessibility

  • Struck and new words carry hidden deleted and inserted labels; folded words leave the accessibility tree.

Motion

  • Strikes are a scaleX line 240 ms, 45 ms apart; new words grow from zero width. Reduced motion: both sides show, no motion.