hide Tabs based on condition

I've seen other component with methods hidden() and visible() which are very useful tbh, but the Tab component lacks of this methods, whats the workaround to hide Tabs based on conditions?
Solution:
I think you can use a closure in tabs(): ```php Tabs::make('My Tabs') ->tabs(function ($get) { if ($get('my_field') === 'value') {...
Jump to solution
2 Replies
Solution
Patrick Boivin
Patrick Boivin12mo ago
I think you can use a closure in tabs():
Tabs::make('My Tabs')
->tabs(function ($get) {
if ($get('my_field') === 'value') {
return [
/* some tabs */
];
}

return [
/* other tabs */
];
})
Tabs::make('My Tabs')
->tabs(function ($get) {
if ($get('my_field') === 'value') {
return [
/* some tabs */
];
}

return [
/* other tabs */
];
})
developer
developer12mo ago
yeah @pboivin it may work, but it would be nice if we have the option to add new custom methods