Hold to confirmPro
Confirm a destructive action by holding, not tapping: the fill runs while held, rewinds smoothly when you let go early and resumes from where it was on a quick re-press; a check draws in when done.
oxyn add hold-to-confirmThe preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.
Rendered from Rust at build time · goes live when visible
When to use
- Confirm a destructive action by holding, not tapping.
- A tap does nothing; holding fills the button over duration; letting go early rewinds the fill on a smooth curve, and pressing again during the rewind resumes from where the fill is instead of from zero.
- When the fill completes the label changes, the width springs and a check draws itself in.
When not to use
- An agent asks before it acts: use Approval Card instead.
- Several open requests in one card: use Approval pager instead.
- An agent's question in its own card above the composer: use Decision Card instead.
Installation
Hold to confirm is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.
oxyn add hold-to-confirmUsage
The preview is free. Pro opens the code of every Pro component, screen and template.
Examples
Danger
Red fill, 1.2 s.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Neutral
Foreground fill, for reversible actions.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Long
2 s hold, large.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Bare
No hint, small.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
API reference
HoldToConfirm
| Prop | Type | Default | Description |
|---|---|---|---|
modelrequired | HoldConfirm | — | Model (fill, confirmed). |
nowrequired | ClockMs | — | Shared clock. |
label | String | "Hold to delete" | Resting label. |
confirmed_label | String | "Done" | Label after the hold completes. |
icon | String | "trash" | Leading icon name. |
size | String | "md" | `sm` · `md` · `lg`. |
hint | bool | true | Show the "Keep holding" hint below. |
on_hold | EventHandler<bool> | — | Hold started (`true`) or ended. |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| SpaceorEnter (hold) | Fills the button; releasing early rewinds it |
| Tab away | Cancels the hold |
Accessibility
- A real button named “… hold to confirm”; the hint below is its description and a polite live region (“Keep holding…”, “Done”).
- The check is drawn in after completion; the label changes to the confirmed label.
From the spec
- Native button named “<label>, hold to confirm”, described by the hint.
- The hint is a polite live region: “Hold to confirm” → “Keep holding…” → “Done”.
- Auto-repeat keydown events are ignored so holding a key does not restart the hold.
Motion & interaction
Timing
- Fill: linear,
duration(1200 ms default,motion.mdhold-to-confirm token). - Rewind: 240 ms smoothstep from the release fill; re-press keeps the current fill as its base.
- Press scale 0.97; check stroke draws in 320 ms.
- Reduced motion: no press scale, no rewind animation (the fill still tracks the hold), check appears without drawing.
Responsive behaviour
- Inline size; touch-action none so a hold never scrolls the page.
Edge cases (spec)
- Inline size;
touch-action: noneso the hold never scrolls the page; three sizes (sm 28, md 34, lg 42 px).
Notes for AI
- Import
HoldToConfirmfromoxyn_dioxusand includeSTATUS_INDICATOR_CSSplus the token stylesheet once. - A GPUI version exists:
HoldConfirmElinoxyn_gpui. - Props to set first:
model,now. - It reads a clock (
now) for live timers; pass one clock for the whole page rather than one per component. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.