© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
2 replies
xy

Custom action not working

I have a custom action to create a new post which I want to use throughout my application on different pages. If i make the same action with Action::make() under my custom page's getHeaderActions, it works but when using my custom action class it doesn't:



<?php

namespace App\Filament\Actions\Posts;

use Filament\Actions\Action;
use Filament\Actions\CreateAction;
use Filament\Forms\Components\Radio;
use Filament\Forms\Components\Textarea;

class NewPost extends Action
{

    protected function setUp(): void
    {
        $this
            ->label('Make post')

            ->form([
                Textarea::make('message')
                    ->placeholder('Message...')
                    ->required(),
            ]);
    }
}
<?php

namespace App\Filament\Actions\Posts;

use Filament\Actions\Action;
use Filament\Actions\CreateAction;
use Filament\Forms\Components\Radio;
use Filament\Forms\Components\Textarea;

class NewPost extends Action
{

    protected function setUp(): void
    {
        $this
            ->label('Make post')

            ->form([
                Textarea::make('message')
                    ->placeholder('Message...')
                    ->required(),
            ]);
    }
}



Used in page:

    protected function getHeaderActions(): array
    {
        return [
            NewPost::make('makePost'),
        ];
    }
    protected function getHeaderActions(): array
    {
        return [
            NewPost::make('makePost'),
        ];
    }


Error:

Class [App\Filament\Actions\Posts\NewPost] extends [Filament\Support\Components\ViewComponent] but does not have a [$view] property defined.
Class [App\Filament\Actions\Posts\NewPost] extends [Filament\Support\Components\ViewComponent] but does not have a [$view] property defined.



Why do i need a view? And what am i supposed to add into the view?
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Action not working in custom view
FilamentFFilament / ❓┊help
3y ago
Custom action buttons not working in production
FilamentFFilament / ❓┊help
3y ago
action not working
FilamentFFilament / ❓┊help
3y ago
Action not working
FilamentFFilament / ❓┊help
3y ago