FilamentF
Filament2y ago
cj

Is it possible to add an ImportAction to a form tab?

I would like to add a button for an ImportAction to a tab on a resource's form.

I understand that ImportAction isn't an acceptable type for this use, but I'm also struggling to find a workaround. Any ideas?

Filament\Forms\Components\Actions::Filament\Forms\Components\{closure}(): Argument #1 ($action) must be of type Filament\Forms\Components\Actions\Action, Filament\Actions\ImportAction given


Tabs\Tab::make('Tab 1')
    Actions::make([
        // This action works fine
        Actions\Action::make('View Some Stuff')                
            ->url(function ($record): string {
                return 'https://yahoo.com';
            })
            ->openUrlInNewTab(),

        // This throws an exception because ImportAction isn't an acceptable type 
        ImportAction::make('importStuff')
            ->label('Import Stuff')
            ->importer(StuffImporter::class)
            ->options(['thing_id' => 1]),
Was this page helpful?