Black Friday: coupon FRIDAY24 for 40% off Yearly/Lifetime membership! Read more here

Filament Table: Move HeaderAction Create Button to Search and Filters Toolbar

2024-11-14

You can move the Create button to be in line with the Search bar.

To do this, we will use a Render Hook on our Table:

app/Filament/Resources/UserResource/Pages/ListUsers.php

public function mount(): void
{
FilamentView::registerRenderHook(
TablesRenderHook::TOOLBAR_START,
function () {
return Blade::render('<x-filament::button tag="a" href="{{ $link }}">Create</x-filament::button>', [
'link' => self::$resource::getUrl('create')
]);
}
);
 
parent::mount();
}

Of course, to disable the original button, we need to clean the header actions:

protected function getHeaderActions(): array
{
return [];
}

That's it. Load the page, and you will see that the button is in line with our Search bar.

Note: Please keep in mind that this is a custom solution. Some actions, like the Modal action button, will not work here.

A few of our Premium Examples: