Hold to confirm
A button for irreversible actions that only confirms when held: a bar or ring fills, letting go early drains it, and on completion the icon swaps to a check — by mouse, touch or holding Space/Enter.
Real scenarios
The component as it is used in a product — not a specimen grid.
A project’s danger zone
Deleting a project cannot be undone, so the button asks for a held press instead of a second dialog. Let go early and the fill drains back; hold for 1.2 seconds and the trash becomes a check while the server deletes (the toast is the round-trip). From the keyboard, hold Space or Enter.
Revoke API keys
The ring variant runs the progress around the icon — tighter rows, same safety. The second one is a warning tone with a longer hold.
nbx_live_•••• 8f2c
nbx_test_•••• 41aa
Right to left
The bar fills from the inline start — the right edge here.
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| label / doneLabel | string | '' / 'Done' | The action’s label and the one shown after confirming; the latter is also announced. |
| duration | int | 1200 | How many milliseconds the press must be held. |
| variant | string | 'bar' | bar fills across the button, ring runs around the icon. |
| action | string | null | A Livewire method called on confirm; the nx-confirm event always fires too. |
| resetAfter | int | 2400 | Return to idle after this many ms; 0 keeps the done state. |
Snippet
<x-nx::hold-to-confirm label="برای حذف نگه دارید" done-label="حذف شد"
hint="برای حذف، دکمه را نگه دارید" action="deleteProject" />