© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
1 reply
Mark Chaney

Default Table Filter when using Tabs

Ok, so I have a quite a few different number of tabs (customer can actually configure it). Its based on different statuses. The first tab though is always 'All'. Now each status might have a type of 'open' or 'closed'. I have a type filter, but i really only want to use it that on the first tab of 'all' as it doesnt make sense to have it on the others. With that said, I really would like to have the 'All' tab filtered by default. I have
SelectFilter::make('type')
    ->default()
    ->visible(function () {
        $shouldShowFilter = ($this->activeTab === 'all');

        if (! $shouldShowFilter) {
            $this->tableFilters['type']['value'] = null;
        }

        return $shouldShowFilter;
    })
    ->options([
        'open' => 'Open',
        'closed' => 'Closed',
    ])
    ->relationship('status', 'type'),
SelectFilter::make('type')
    ->default()
    ->visible(function () {
        $shouldShowFilter = ($this->activeTab === 'all');

        if (! $shouldShowFilter) {
            $this->tableFilters['type']['value'] = null;
        }

        return $shouldShowFilter;
    })
    ->options([
        'open' => 'Open',
        'closed' => 'Closed',
    ])
    ->relationship('status', 'type'),
, which kind of works as it removes the filter and hides it if you move to another tab, but the problem is that obviously when you come back to the All tab, its now gone. Now the reason i dont just have it as part of the query is that I want to show that its enabled and allow the user to remove it. Thoughts?
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

Default table filter in combination with tabs
FilamentFFilament / ❓┊help
3w ago
Using Blade Tabs to filter `getFooterWidgets()`
FilamentFFilament / ❓┊help
5mo ago
Filter Table using Action
FilamentFFilament / ❓┊help
3y ago
Testing Filter Tabs
FilamentFFilament / ❓┊help
2y ago