Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filamentβ€’12mo agoβ€’
9 replies
Alexandre

How do I use actions on a ViewRecord page?

Hi, I've created a custom ViewRecord view for my resource with a section showing several buttons and actions. I've created an action that should open a modal with a form. The action is rendered correctly but when I click, I see the spinner and nothing happens (0 console or PHP errors).

Here my ViewRecord (without all stuffs) and a dump action :

class ViewOrder extends ViewRecord
{
    protected static string $resource = OrderResource::class;

    protected static string $view = 'filament.resources.order.view-order';



    public function generateJobSheet(): Action
    {
        return Action::make('test')
            ->form([
                Select::make('user_id')
                    ->options(User::all()->pluck('email', 'id')),
            ])
            ->action(function (array $data): void {
                dd($data);
            });
    }

    public function infolist(Infolist $infolist): Infolist
    {
        return $infolist->schema([...]);
    }

    protected function getHeaderActions(): array
    {
        return [...];
    }
}
class ViewOrder extends ViewRecord
{
    protected static string $resource = OrderResource::class;

    protected static string $view = 'filament.resources.order.view-order';



    public function generateJobSheet(): Action
    {
        return Action::make('test')
            ->form([
                Select::make('user_id')
                    ->options(User::all()->pluck('email', 'id')),
            ])
            ->action(function (array $data): void {
                dd($data);
            });
    }

    public function infolist(Infolist $infolist): Infolist
    {
        return $infolist->schema([...]);
    }

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


And my view attached)
(I copied and pasted the default view and added my part)

I also tried to follow that guide : https://filamentphp.com/docs/3.x/actions/adding-an-action-to-a-livewire-component with adding this but nothing changed :

class ViewOrder extends ViewRecord implements HasActions, HasForms
{
    use InteractsWithActions;
    use InteractsWithForms;

    protected static string $resource = OrderResource::class;

    protected static string $view = 'filament.resources.order.view-order';

    public function getFormStatePath(): ?string
    {
        return 'data';
    }
class ViewOrder extends ViewRecord implements HasActions, HasForms
{
    use InteractsWithActions;
    use InteractsWithForms;

    protected static string $resource = OrderResource::class;

    protected static string $view = 'filament.resources.order.view-order';

    public function getFormStatePath(): ?string
    {
        return 'data';
    }


I thought it might be coming from the Section, so I removed the button to put it lower down, but the same thing happened...
Can somebody help me ?
Thanks πŸ™‚
message.txt7.63KB
Adding an action to a Livewire component - Actions - Filament
Solution
Do you really need to overwrite the view? Header Actions don't fit for your use case?

Regarding the action:
The action name and the function must match. In your case the function should be named
testAction()
testAction()
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

RelationManager actions on ViewRecord page
FilamentFFilament / β“β”Šhelp
6mo ago
Actions in footer (bottom of ViewRecord page)
FilamentFFilament / β“β”Šhelp
3y ago
Use Action in custom ViewRecord page
FilamentFFilament / β“β”Šhelp
3y ago
How to use all available Tailwind classes in custom ViewRecord page?
FilamentFFilament / β“β”Šhelp
15mo ago