-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show tooltip for disabled action button #13671
base: 3.x
Are you sure you want to change the base?
Conversation
Please test this by adding two buttons inside |
I created 3 different full page lw components with 2 action buttons per each. Both actions have tooltip, but one action is enabled and the other one is disabled (I also tried disabling it both actions, results look the same). The class part looks the same for all 3. The view part changes on the classes used. @danharrin is this what you expected me to try out? test.mp4Component classes: <?php
namespace App\Livewire;
use App\View\Components\AppLayout;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Components\Actions;
use Filament\Forms\Components\Actions\Action;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Form;
use Illuminate\Contracts\View\View;
use Livewire\Component;
class Test1 extends Component implements HasForms
{
use InteractsWithForms;
public function render(): View
{
return view('livewire.test1')->layout(AppLayout::class);
}
public function form(Form $form): Form
{
return $form->schema([
Actions::make([
Action::make('star')
->icon('heroicon-m-star')
->tooltip('First tooltip'),
Action::make('resetStars')
->icon('heroicon-m-x-mark')
->color('danger')
->tooltip('Second tooltip')
->disabled(),
]),
]);
}
} Component views: // test 1
<div class="grid grid-cols-2">
{{ $this->form }}
</div> // test 2
<div class="flex justify-end">
{{ $this->form }}
</div> // test 3
<div class="flex justify-between">
{{ $this->form }}
</div> |
Probably is to directly using actions https://filamentphp.com/docs/3.x/actions/adding-an-action-to-a-livewire-component#adding-the-action |
Oh yeah I see. Okay, I test it again. |
New tests: test2.mp4Classes: <?php
namespace App\Livewire;
use App\View\Components\AppLayout;
use Filament\Actions\Concerns\InteractsWithActions;
use Filament\Actions\Contracts\HasActions;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Components\Actions;
use Filament\Actions\Action;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Form;
use Illuminate\Contracts\View\View;
use Livewire\Component;
class Test1 extends Component implements HasForms, HasActions
{
use InteractsWithForms;
use InteractsWithActions;
public function render(): View
{
return view('livewire.test1')->layout(AppLayout::class);
}
public function oneAction(): Action
{
return Action::make('one')
->disabled()
->tooltip('One');
}
public function twoAction(): Action
{
return Action::make('two')
// ->disabled()
->tooltip('Two');
}
} Views: // test 1
<div class="grid grid-cols-2">
{{ $this->oneAction }}
{{ $this->twoAction }}
<x-filament-actions::modals />
</div> // test 2
<div class="flex justify-end">
{{ $this->oneAction }}
{{ $this->twoAction }}
<x-filament-actions::modals />
</div> // test 3
<div class="flex justify-between">
{{ $this->oneAction }}
{{ $this->twoAction }}
<x-filament-actions::modals />
</div> |
Could you please do the same video for icon button actions, @ericmp33? |
I updated the tests & fixed the code. Here you have a table to know what functions I used for both actions in each test.
*For each test, the 1st action is always disabled and the 2nd it's not. Before: before_my_changes.mp4After: after_my_changes.mp4 |
Think I'm going to push this to v4 since it does have some capability to be a breaking change with certain style customizations |
Description
We would like to show a tooltip on a disabled action button to explain why that button is disabled. #4271
One thing to note is that this change might be an unexpected behavior for developers who previously had tooltips configured to display only when actions were enabled. We should consider mentioning this update in the
What's Changed
section of the release notes to avoid confusion.Visual changes
If the action has a tooltip, despite being disabled, the tooltip will be shown.
Functional changes
composer cs
command.