You are currently viewing the documentation for Filament 4.x, which is a previous version of Filament.Looking for the current stable version? Visit the 5.x documentation.
If you have expensive queries powering your tab badges, the initial page load may be slow. You can defer the loading of tab badges using the deferBadge() method, which will load the badge values asynchronously after the page has rendered:
The badge() value must be returned from a function when using deferBadge(). If you pass a raw value like badge(Notification::query()->count()), the query runs immediately when the tab is built, defeating the purpose of deferral.The Tabs component must have a key() set when using deferBadge(). Without a key, the deferred badge request cannot identify the correct component on the server.
Tabs are rendered horizontally by default, and are scrollable when they exceed the available width.You may disable scrolling using the scrollable(false) method:
use Filament\Schemas\Components\Tabs;Tabs::make('Tabs') ->tabs([ // ... ]) ->scrollable(false)
When tabs are not scrollable, the component automatically detects the available width. If not all tabs can fit, a dropdown button will appear. Any tabs that exceed the available width will be grouped inside this dropdown automatically.
If you set custom id() values, keep them unique across the page so headers remain associated with the correct panels. Use distinct keys for separate tabsets, including nested tabsets with the same tab labels.
Persisting the current tab in the user’s session
By default, the current tab is not persisted in the browser’s local storage. You can change this behavior using the persistTab() method. You must also pass in a unique id() for the tabs component, to distinguish it from all other sets of tabs in the app. This ID will be used as the key in the local storage to store the current tab:
use Filament\Schemas\Components\Tabs;Tabs::make('Tabs') ->tabs([ // ... ]) ->persistTab() ->id('order-tabs')
Optionally, the persistTab() method accepts a boolean value to control if the active tab should persist or not:
use Filament\Schemas\Components\Tabs;Tabs::make('Tabs') ->tabs([ // ... ]) ->persistTab(FeatureFlag::active()) ->id('order-tabs')
When enabled, the current tab is persisted in the URL’s query string using the tab key. You can change this key by passing it to the persistTabInQueryString() method:
If the content of a tab is expensive to render, you can pass a Schema object to its schema() method and use deferLoading(). The content of the active tab will be loaded when it enters the viewport. The content of an inactive tab will not be loaded until the tab is selected:
Every deferred schema must have a unique key. In this example, the keys on the tabs are inherited by their child schemas, while the key on the Tabs component namespaces them from other tabs in the same schema. You can learn more in the schema overview.
If your livewireProperty() tabs change a filter instead of showing separate content panels, use tabPanels(false). This renders a labelled group of buttons with a pressed state rather than a tablist:
Resource list filters use this mode automatically. For links that navigate to another page, use the tabs Blade component instead. Navigation links keep their native link behavior and are not schema tab panels.