FilamentF
Filament15mo ago
Mateus

action button in topbar

Hi! I'm trying to put an action button on the topbar, but nothing is happening when I click on the action.

My code is like this:
Livewire component:
public function customAction(): Action
    {
        return Action::make('Buscar Pacote')
                ->requiresConfirmation()
                ->label('Custom Action')
                ->color('gray');
    }
    public function render()
    {
        return view('livewire.scan-action');
    }

Hook on the panel provider:
return $panel
        ->renderHook(
            PanelsRenderHook::GLOBAL_SEARCH_BEFORE,
                fn (): string => Blade::render('@livewire(\'scan-action\')'),
        )
Solution
Ah, it’s because the name of the action doesn’t match the output in the blade file.

Action::make(‘custom)

{{ $this->customAction }}
Was this page helpful?