block-lab
block-lab copied to clipboard
Field Conditions
Depending on the value of another field in the same block, whether a field should be displayed or not.
If field_one
is equal to foo
then hide field_two
.
@lukecarbis, just ran into two cases for field conditions:
First use case:
It takes two fields to build a button in my block: a "button-text" field and a "button-url" field. The user keeps entering in "button-text" without "button-url". Ideally, both fields would be required if they are using one of them.
Another use case:
A user can choose between a background image or a background color from a "background" select field in a block. If they choose a background image, the image field should conditionally show. There is no reason for the background image field to show if they chose a color for the background.
Hi there, I'm a web project manager at cultureamp.com and we would really love the ability to use conditional fields. Can you provide an update on the priority and timeline for this issue?
Question about scope
Hi @lukecarbis, Sorry I missed you yesterday. Could you please help with a question about the scope here?
Depending on the value of another field in the same block, whether a field should be displayed or not.
It sounds like this issue does not include conditions that apply to the entire block, right?
There are already some, like:

Some more block-level conditions, like ACF has, might be 'if current user is logged in' or 'page template is default template.'
It sounds like the only conditionals in scope here are field-level. Is that true?
For example, in ACF:

Thanks, Luke!
Yes, only field level. We could consider opening separate issues for other options – but to my knowledge there's been no demand for that level of functionality.
Thanks, that sounds great.