How can add tabs in custom page?
can we use getTabs function in custom pages in Filament V3 so we can show the on top of the Table? Like this?
public function getTabs(): array
{
return [
null => ListRecords\Tab::make('All'),
'new' => ListRecords\Tab::make()->query(fn ($query) => $query->where('status', 'new')),
'processing' => ListRecords\Tab::make()->query(fn ($query) => $query->where('status', 'processing')),
'shipped' => ListRecords\Tab::make()->query(fn ($query) => $query->where('status', 'shipped')),
'delivered' => ListRecords\Tab::make()->query(fn ($query) => $query->where('status', 'delivered')),
'cancelled' => ListRecords\Tab::make()->query(fn ($query) => $query->where('status', 'cancelled')),
];
}
3 Replies
It's a feature of ListRecords page. It's basically a tab component and modifying the query based on the current query string.
Also please read #✅┊rules on how to format code.
Hi Dennis, Apologise for not following the code formatting guideline.
So basically I can't use that tab component on any custom page, correct?
You can use the tab component. See the source code of
list-records.blade.php
The code you showed isn't a component though. It's a feature defined in the ListRecords page.