© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
1 reply
Eugen Pașca

Error on the hidden method on Action (Typed property ...Component::$container)

Hello,
I am having some issues with an action that i have places inside a form:
Section::make(__('app..description'))
  ->schema([

      TableRepeater::make('name')
          ->label('label')
          ->relationship('relationship')
          ->schema([

              TextInput::make('product'),
              TextInput::make('company_id'),
              TextInput::make('quantity'),
              TextInput::make('price'),
              
              Actions::make([
                  Actions\Action::make('action_name')
                      ->label(__('app.label'))
                      ->requiresConfirmation()
                      ->color('danger')
                      ->tooltip(__('app._tooltip'))
                      ->iconButton()
                      ->icon('heroicon-o-x-circle')
                      ->action(function (ClusterOrderItemAssignment $item) {
                        //...
                      })
                      ->hidden(function (?Model $record) {
                          return $record->some_bool_attribute;
                      }),
              ]),
          ])
          ->hideLabels()
          ->columnSpanFull(),
  ]);
Section::make(__('app..description'))
  ->schema([

      TableRepeater::make('name')
          ->label('label')
          ->relationship('relationship')
          ->schema([

              TextInput::make('product'),
              TextInput::make('company_id'),
              TextInput::make('quantity'),
              TextInput::make('price'),
              
              Actions::make([
                  Actions\Action::make('action_name')
                      ->label(__('app.label'))
                      ->requiresConfirmation()
                      ->color('danger')
                      ->tooltip(__('app._tooltip'))
                      ->iconButton()
                      ->icon('heroicon-o-x-circle')
                      ->action(function (ClusterOrderItemAssignment $item) {
                        //...
                      })
                      ->hidden(function (?Model $record) {
                          return $record->some_bool_attribute;
                      }),
              ]),
          ])
          ->hideLabels()
          ->columnSpanFull(),
  ]);


From my tests, when i add the hidden method and add a Model property to the callback i get this error:
Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization
Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization


Any idea why? it works on other fields, only on action I get this error.

As for versions:
- PHP 8.2.11
- Laravel: 10.41.0
- Filament: 3.0.12
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

Typed property Filament\Forms\Components\Component::$container must not be accessed
FilamentFFilament / ❓┊help
3y ago
Calculated State Typed property Filament\Forms\Components\Component::$container must not be accessed
FilamentFFilament / ❓┊help
3y ago
`Typed property Filament...Component::$container must not be accessed before init` from custom field
FilamentFFilament / ❓┊help
11mo ago
Additional validations on the `action` method for Standalone action
FilamentFFilament / ❓┊help
3y ago