Skip to content
Sign upGet access
MicrointeractionsApply to fileMenu

Apply to file (Pro)

ProIncluded in $99

Apply for assistant code: a miniature of the block drops into the file's tab, which marks itself changed and counts the lines.

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

$ pnpm dlx shadcn@latest add @chatcn-pro/apply-to-file

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 { 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

PropTypeNotes
status"idle" | "applying" | "applied" | "error"ApplyToFile
from / targetRefObject<HTMLElement>The code block and the file tab
onApply / onUndo() => void
labelsPartial<Record<status, string>>
name, added, removed, activeFileTabCounts 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.