Apply to file (Pro)
ProIncluded in $99Apply for assistant code: a miniature of the block drops into the file's tab, which marks itself changed and counts the lines.
On this page
ProApply drops a miniature of the code into its file's tab, which marks itself changed and counts the lines.
Press Apply and a miniature of the code block leaves the answer and drops into the file it belongs to. The file's tab takes it with a small dip and rolls up its added and removed lines in green and red. The button edits from Apply to Applying to Applied with a run check finishing beside it, and offers Undo.
Installation
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
import { ApplyToFile, FileTab } from "@/components/ui/chatcn/pro/apply-to-file"
<FileTab ref={tab} name="lib/session.ts" added={diff.added} removed={diff.removed} active />
<ApplyToFile status={status} from={codeRef} target={tab} onApply={apply} onUndo={undo} />Props
| Prop | Type | Notes |
|---|---|---|
status | "idle" | "applying" | "applied" | "error" | ApplyToFile |
from / target | RefObject<HTMLElement> | The code block and the file tab |
onApply / onUndo | () => void | |
labels | Partial<Record<status, string>> | |
name, added, removed, active | FileTab | Counts roll as they change |
Accessibility
- The tab reads its counts in words: 9 added, 4 removed.
- The miniature is inert and hidden from assistive tech.
Motion
- The shared miniature flight from
chatcn-micro, 600 ms; the tab dips 2 px on landing. - Reduced motion: no flight; the counts and labels still change.