Hold to run (Pro)
ProIncluded in $99Approval you have to mean: hold the agent's command and ink fills the row through the text itself, inverting every letter it passes.
On this page
ProPress and hold the command: ink fills the row through the text. Let go early and it drains back. The production deploy needs a longer hold and fills red.
A tap is too easy for a migration or a production deploy. Here the command is the button: press and hold and ink fills the row from the start, running through the command so each letter it passes turns to paper. Let go early and the fill drains back on a spring that keeps its speed, so a hesitant press reads as hesitation. Hold to the end and it runs; the row stays inked with a run check while it works, then clears.
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 { HoldToRun } from "@/components/ui/chatcn/pro/hold-to-run"
<HoldToRun
command="pnpm db:migrate --env production"
tone="danger"
holdMs={1800}
status={status}
onConfirm={run}
/>Examples
States and tones
ProIdle, running, done and failed, for a staging command and for a production one in the danger tone.
Props
| Prop | Type | Notes |
|---|---|---|
command | string | Shown in mono; the row is the button |
onConfirm | () => void | Runs once the hold completes |
status | "idle" | "running" | "done" | "error" | Drive it after confirm. Back to idle drains the ink |
holdMs | number | Default 1100. Longer for anything destructive |
tone | "default" | "danger" | Danger fills red |
icon | ReactNode | Replaces the terminal glyph |
labels | Partial<Record<status | "holding", string>> | Right side text per state |
Keyboard
- Hold
SpaceorEnterfor the same time. Releasing early cancels.
Accessibility
- A button named with its action and command. The inked copy of the row is
aria-hidden. - The right side label edits in place (Hold to run, Keep holding, Running) so the state is readable, not only visible.
- A context menu on long press is suppressed so a touch hold is not interrupted.
Motion
- Filling is a steady ramp you control, eased so the first frames already show ink; draining is a spring that starts from the ink on screen, with its speed.
- The fill is a
clip-pathinset on an inverted copy of the row: one property, compositor friendly. - The row presses to 0.985 while held. Reduced motion keeps the fill (it is the progress) and drops the ease.