When dealing with confirmation modals - it is important to customize the message. You can do that with a callback when using Filament Actions.
When dealing with Actions in Filament, you might have seen ->requiresConfirmation()
added like this:
Tables\Actions\Action::make('Set as Default') ->icon('heroicon-o-star') ->hidden(fn($record) => $record->is_default) ->requiresConfirmation(),
What if we want to add a custom message to the confirmation dialog? We can do that by adding a closure to the requiresConfirmation()
method like this:
Tables\Actions\Action::make('Set Default') ->icon('heroicon-o-star') ->hidden(fn($record) => $record->is_default) ->requiresConfirmation(function (Tables\Actions\Action $action, $record) { $action->modalDescription('Are you sure you want to set this as the default pipeline stage?'); $action->modalHeading('Set "' . $record->name . '" as Default'); return $action; })
You can set whatever message you want and even use the record data to make it more dynamic.
This example is based on our Customer Management CRM
A few of our Premium Examples: