© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•4mo ago
98.dev

How to Access Selected Records in a BulkAction::visible() in Filament?

We're trying to achieve the following scenario:

BulkAction::make('download_reports')
    ->label('Download Selected')
    ->visible(function ($selectedRecords) {        
        // If single record selected, hide if already downloaded
        if ($selectedRecords->count() === 1) {
            return !$selectedRecords->first()->downloaded;
        }

        // If multiple records selected, and all have been downloaded, hide the button
        if ($selectedRecords->every(fn ($record) => $record->downloaded)) {
            return false;
        }
        
        return true;
    })
BulkAction::make('download_reports')
    ->label('Download Selected')
    ->visible(function ($selectedRecords) {        
        // If single record selected, hide if already downloaded
        if ($selectedRecords->count() === 1) {
            return !$selectedRecords->first()->downloaded;
        }

        // If multiple records selected, and all have been downloaded, hide the button
        if ($selectedRecords->every(fn ($record) => $record->downloaded)) {
            return false;
        }
        
        return true;
    })


However, it appears that we cannot access the selected records inside the
->visible()
->visible()
attribute, as
$selectedRecords
$selectedRecords
always returns
null
null
.

Is there a way to access the selected records in the visible attribute, or is this not supported?

I understand there is a
checkIfRecordIsSelectableUsing
checkIfRecordIsSelectableUsing
attribute at table level, however that hides all the bulk actions.
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

How to run a BulkAction on selected to table records
FilamentFFilament / ❓┊help
2y ago
BulkAction options based on selected records.
FilamentFFilament / ❓┊help
2y ago
How to get selected records without any BulkAction or Action?
FilamentFFilament / ❓┊help
6mo ago
Can Bulkaction buttons remain visible without being selected?
FilamentFFilament / ❓┊help
16mo ago