How to explain to the user why the button is disabled

I have to disable this table button if the payment is already paid. But that is it, the user just sees that can't click the button. If i try to add a tooltip, as is disabled, isn't shown.
->actions([
Tables\Actions\Action::make('edit_expiration_date')
->disabled(function (Payment $record): bool {
return $record->status === PaymentStatusEnum::Paid;
})
->tooltip(function (Payment $record): ?string {
if ($record->status === PaymentStatusEnum::Paid) {
return __('The payment is already paid');
}

return null;
})
->actions([
Tables\Actions\Action::make('edit_expiration_date')
->disabled(function (Payment $record): bool {
return $record->status === PaymentStatusEnum::Paid;
})
->tooltip(function (Payment $record): ?string {
if ($record->status === PaymentStatusEnum::Paid) {
return __('The payment is already paid');
}

return null;
})
So hmmm, how can i add a tooltip explaining why the button is not clickable to the user without letting them to click it???
No description
2 Replies
awcodes
awcodes6mo ago
Disabled buttons don’t emit js hover events so tooltip doesn’t know if it’s hovered or not. I would either not show the button or change the label to reflect the status as already paid.
ericmp #2
ericmp #26mo ago
okay, thanks 🙌