© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•4mo ago•
21 replies
3rgo

Dynamic table record Action label

Hello, I've been trying unsuccessfully to set a dynamic label to a recordAction in a filament resource table.

In v3 I could do this easily:
Tables\Actions\Action::make('evaluations')
                    ->label(fn(Application $record) => __('admin.application.evaluations', ['count' => $record->evaluations->count()]))
                    ->url(fn(Application $record) => route('filament.admin.resources.applications.evaluations', ['record' => $record]))
Tables\Actions\Action::make('evaluations')
                    ->label(fn(Application $record) => __('admin.application.evaluations', ['count' => $record->evaluations->count()]))
                    ->url(fn(Application $record) => route('filament.admin.resources.applications.evaluations', ['record' => $record]))


But the same code now throws an error, because the $record given to the callback is null. I tried dumping it and even with a full page (10 records) the callback is only called once without the record.

Am i missing something ? This seems in direct contradiction to the documentation stating "All methods on the action accept callback functions, where you can access the current table $record that was clicked."
Solution
After checking this is not an issue with the framework, because a minimal repository could not reproduce the issue.
I checked over my project and remembered that I set up some global overrides when I upgraded to Filament v4 a month ago, using the
modifyUngroupedRecordActionsUsing
modifyUngroupedRecordActionsUsing
as described in the documentation (https://filamentphp.com/docs/4.x/tables/actions#global-record-action-settings), to ensure table actions labels were using my own label translations. The unfortunate side effect of this was forcing the label for all actions, not just the View/Edit/Delete :
Table::configureUsing(
    fn (Table $table): Table => $table
        ->modifyUngroupedRecordActionsUsing(fn (Action $action): Action => $action
            ->label(match ($action->getName()) {
                'view'   => __('generic.actions.view'),
                'edit'   => __('generic.actions.edit'),
                'delete' => __('generic.actions.delete'),
                default  => $action->getLabel(),
            })
        )
);
Table::configureUsing(
    fn (Table $table): Table => $table
        ->modifyUngroupedRecordActionsUsing(fn (Action $action): Action => $action
            ->label(match ($action->getName()) {
                'view'   => __('generic.actions.view'),
                'edit'   => __('generic.actions.edit'),
                'delete' => __('generic.actions.delete'),
                default  => $action->getLabel(),
            })
        )
);

The default case is the root cause of my initial issue I believe. I've replaced this behaviour with ViewAction/EditAction/DeleteAction overrides and everything now works.
Thank you @toeknee and @Dan Harrin and sorry for taking up your time with this.
Actions - Tables - Filament
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

dynamic table filter label
FilamentFFilament / ❓┊help
3y ago
Dispatch Table Record Action
FilamentFFilament / ❓┊help
3mo ago
Table Action Labels
FilamentFFilament / ❓┊help
3y ago
Table Action always the same record
FilamentFFilament / ❓┊help
2y ago