© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
10 replies
Sauravisus

Adding a save button to EditPage header

So I'm trying to move the save button from the form actions to the header actions, and snatching it out of there with
parent::getFormActions()
parent::getFormActions()
and putting that into my header actions does show the button, but the button itself doesn't work, as it's no longer within the form tag.

How would I go about adding a custom action that actually saves the form currently being viewed in an edit page? It's a standard EditRecord page we're talking about here.

protected function getHeaderActions(): array
    {
        $actions = parent::getFormActions();

        return [
            Arr::first($actions)->action('save'),
            Action::make('optimized')
                ->label('Mark as Optimized')
                ->requiresConfirmation()
                ->action(function (Task $task) {
                    $task->calculateNewDeadline();
                    $this->refreshFormData([
                        'status',
                        'urgency',
                    ]);
                }),
            Arr::last($actions)
        ];
    }
protected function getHeaderActions(): array
    {
        $actions = parent::getFormActions();

        return [
            Arr::first($actions)->action('save'),
            Action::make('optimized')
                ->label('Mark as Optimized')
                ->requiresConfirmation()
                ->action(function (Task $task) {
                    $task->calculateNewDeadline();
                    $this->refreshFormData([
                        'status',
                        'urgency',
                    ]);
                }),
            Arr::last($actions)
        ];
    }


This is how I grabbed the buttons from the edit form. The cancel button works fine, but that's just a link so it should. Only the save button isn't working as intended. It's the
Arr::first($actions)
Arr::first($actions)
one in that list.
Solution
For others trying to replicate adding a save button to the header:

Action::make('save')
    ->label('Save changes')
    ->action('save'),
Action::make('save')
    ->label('Save changes')
    ->action('save'),


Toss that into your getHeaderActions array, and you're off to the races. 👍
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Adding Button/Action to Panel Header
FilamentFFilament / ❓┊help
3y ago
Placing a save button in the header
FilamentFFilament / ❓┊help
2y ago
Adding Header Action to a resource
FilamentFFilament / ❓┊help
3y ago
Custom "Save" button to create or save a form
FilamentFFilament / ❓┊help
2y ago