FilamentF
Filament2y ago
Adel

Add Action to custom widget

I am trying to use actions in custom widget following the docs below, but the modal is not showing

https://filamentphp.com/docs/3.x/widgets/adding-a-widget-to-a-blade-view

use Filament\Actions\Concerns\InteractsWithActions;
use Filament\Actions\Contracts\HasActions;

class Timeline extends Widget implements HasActions, HasForms
{
    use InteractsWithActions;
    use InteractsWithForms;

    public function testAction()
    {
        return Action::make('test')
            ->requiresConfirmation();
    }

}


<x-filament-widgets::widget>
    <x-filament::section>
        
        <x-filament::button wire:click="testAction">
            Test Actiom
        </x-filament::button>

        <x-filament-actions::modals />
    </x-filament::section>
</x-filament-widgets::widget>
Was this page helpful?