Skip to main content
← Back to Table of Contents

Summary

Press-and-hold confirmation for high-risk Filament actions (delete account, purge data, irreversible settings). The user must keep the button pressed until a fill animation completes — a single click does nothing. Accidental taps are blocked; intentional actions feel deliberate.
Important: Import the package action class, not Filament’s base class: use Bjanczak\FilamentFlexFields\Filament\Actions\Action;

When to use it

Hold confirm works in forms, infolists, tables, modals, and ItemCard trailing slots. It supports Livewire action() callbacks and url() navigation.

Quick start

Defaults: 2000 ms hold, sweep from right, 200 ms release animation, danger-themed palette when color('danger').

How it works

  1. PHP renders the normal Filament button, then wraps label/icon in base and overlay layers (renderHoldConfirmTriggerHtml()).
  2. The action view swaps to filament-flex-fields::actions.hold-confirm and disables the default Livewire click handler.
  3. Alpine holdConfirmActionFormComponent listens for pointer down on the left mouse button / touch.
  4. Progress fills over duration ms using a directional clip-path (sweep).
  5. Releasing early reverses progress over releaseDuration ms.
  6. At 100%, Alpine dispatches fff-hold-complete → $wire.mountAction('…') or navigates to url().
Ordinary click events are suppressed so the action cannot fire without completing the hold.

Configuration catalog

Inherited Filament APIs (label(), icon(), color(), size(), disabled(), url(), action(), requiresConfirmation(), etc.) work as usual.

Basic usage

Default hold (2 seconds)

Custom duration

Fast confirmation (800 ms)

Useful for lower-risk actions that still benefit from intentional input:

Sweep direction

The fill animation direction. Second argument to holdConfirm() or via holdConfirmSweep().

right (default)

left

up

down

Change sweep after holdConfirm()

Invalid values (e.g. 'diagonal') throw InvalidArgumentException.

Release animation

When the user releases before completion, progress animates back to zero.

Theming

When holdConfirmThemed() is enabled (default), color('danger') applies the package danger track/fill palette (fff-hold-confirm-action--palette-danger) and defaults to fully rounded corners.

Danger palette (default for destructive actions)

Keep Filament’s native button colors

Primary / success / warning

Themed palette applies only to danger today. Other colors use Filament styling with the hold overlay on top:

Rounded corners

Use the package rounded() helper (CanRoundAction):
Supported values: none, sm, md, lg, xl, full.

Item card integration

Common pattern: destructive control in an ItemCard trailing slot.
Combine itemCard() + holdConfirm() for settings-style rows. See the playground Hold confirm hub (/admin/flex-fields-playground/hold-confirm) for standalone action demos, and Item card group for card-embedded actions.

Table actions

Works with bulk actions, header actions, and relation managers — anywhere Filament accepts Action instances. Always use the package Action class.

Resource page actions


URL actions

Hold confirm can navigate instead of calling Livewire:

Disabled state

When the action is disabled, Alpine receives disabled: true and ignores pointer down:

Comparison with modal confirmation

Choose hold confirm when you want inline, tactile friction without a second step. Choose requiresConfirmation() when you need to show extra context, a checkbox, or typed confirmation in a modal.

Assets & performance

CSS is not in the global core.css bundle — only actions that call holdConfirm() pull the stylesheet. After upgrading the package, run:

Accessibility & mobile

  • Only primary button (event.button === 0) starts a hold; right-click is ignored.
  • Progress is visual; pair with a clear label() (e.g. “Hold to Delete”).
  • On supported devices, a short vibration fires when the hold completes.
  • wire:loading indicators are preserved outside the duplicated label layers.
For critical destructive actions, consider adding helper text in the surrounding UI (ItemCard description, modal heading, etc.).

Playground

Three hold-confirm demos: Open Flex Fields Playground → Hold confirm (/admin/flex-fields-playground/hold-confirm).

API reference

holdConfirm(int|Closure $duration = 2000, string|Closure $sweep = 'right'): static

Enables hold-to-confirm, sets duration and sweep, disables Livewire click handler, switches view to hold-confirm. Auto-applies rounded('full') for danger actions when no explicit rounded() was set.

holdConfirmSweep(string|Closure $sweep): static

Updates sweep direction: right, left, up, down.

holdConfirmReleaseDuration(int|Closure $duration): static

Milliseconds to animate progress back to zero when the user releases early. Default: 200.

holdConfirmThemed(bool|Closure $themed = true): static

When true, applies package danger palette for color('danger'). When false, keeps Filament’s default button styling.

Introspection (advanced)