Add action buttons to custom page with HasForms

Hi everyone,

I have a question regarding the best method to add action buttons, such as "Create" to my custom page. I've been searching through the documentation, but couldn't find any relevant information.

I attempted to implement the HasFormActions interface on my Page and added the getCachedFormAction() method. However, I'm unsure how to properly render these buttons in the view.

If anyone has any insights or suggestions, I would greatly appreciate your help.

Thank you!

class Edit extends Page implements HasForms, HasFormActions
{
    use InteractsWithForms;

// ... 

    public function getCachedFormAction(string $name): ?\Filament\pages\Actions\Action
    {
        if ($name === 'submit') {
            return \Filament\pages\Actions\Action::make('submit')
                ->action('submit')
                ->icon('heroicon-s-save');
        }
            return null;
        }
    }


and my view :

<x-filament::page>
   
        {{ $this->form }}

</x-filament::page>
Was this page helpful?