© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
4 replies
*

using hiddenOn and hidden in conjunction

Currently, there's no way of achieving this, as the last chained call will override the previous.

something like this, quite understandably will not work:
->hiddenOn('create')
->hidden(fn () => someLogicReturningABool())
->hiddenOn('create')
->hidden(fn () => someLogicReturningABool())

What I'm trying to achieve is, hide a tab in a form on
create
create
, and on
edit
edit
, have a closure to run some custom logic to hide or show it.

The only solution I can think of is duplicating the code for the
hiddenOn
hiddenOn
method in the
hidden
hidden
closure, which is less than ideal.

Any suggestions on how to tackle this?
Solution
I think you can inject a
$context
$context
parameter in the magic closure:
->hidden(fn ($context) => $context === 'create' || someLogicReturningABool())
->hidden(fn ($context) => $context === 'create' || someLogicReturningABool())
Jump to solution
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

hidden and hiddenOn issue on TextColumn field.
FilamentFFilament / ❓┊help
3mo ago
hiddenOn alternative for Action
FilamentFFilament / ❓┊help
3y ago
Show latitude and longitude in Hidden
FilamentFFilament / ❓┊help
2y ago
Using $set on hidden field
FilamentFFilament / ❓┊help
12mo ago