Skip to content
Back

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-confirm
Hold to confirm
The code is part of Oxyn Pro

The preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.

Get Pro

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.

Terminal
oxyn add hold-to-confirm

Usage

Dioxus · rust
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Examples

Danger

Red fill, 1.2 s.

Hold to confirm
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Neutral

Foreground fill, for reversible actions.

Hold to confirm
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Long

2 s hold, large.

Hold to confirm
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Bare

No hint, small.

Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

API reference

HoldToConfirm

PropTypeDefaultDescription
modelrequiredHoldConfirm—Model (fill, confirmed).
nowrequiredClockMs—Shared clock.
labelString"Hold to delete"Resting label.
confirmed_labelString"Done"Label after the hold completes.
iconString"trash"Leading icon name.
sizeString"md"`sm` · `md` · `lg`.
hintbooltrueShow the "Keep holding" hint below.
on_holdEventHandler<bool>—Hold started (`true`) or ended.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
SpaceorEnter (hold)Fills the button; releasing early rewinds it
Tab awayCancels 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.md hold-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: none so the hold never scrolls the page; three sizes (sm 28, md 34, lg 42 px).

Notes for AI

  • Import HoldToConfirm from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • A GPUI version exists: HoldConfirmEl in oxyn_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.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI