Change Action Label from action method

example code Action::make('test-1') ->label('ChangeMe') ->icon('heroicon-m-sparkles') ->action(function () { //change label ChangeMe from here? }),
Solution:
You can't do that. But you can use a dynamic label based on a condition:
->label(fn () => $condition ? 'Label 1' : 'Label 2')
->label(fn () => $condition ? 'Label 1' : 'Label 2')
...
Jump to solution
4 Replies
Solution
Dennis Koch
Dennis Koch12mo ago
You can't do that. But you can use a dynamic label based on a condition:
->label(fn () => $condition ? 'Label 1' : 'Label 2')
->label(fn () => $condition ? 'Label 1' : 'Label 2')
MaSTeRMinD
MaSTeRMinDOP12mo ago
I'm executing some longer running functions and i was planning on changing the button to something like Please wait... but i guess that will have to do. Thanks
Dennis Koch
Dennis Koch12mo ago
There should be a loading indicator for that case
MaSTeRMinD
MaSTeRMinDOP12mo ago
yeah there is, I just wanted to do some more info for the "blind"
Want results from more Discord servers?
Add your server