Easily restore your project to a previous version with our new Instant One-click Backup Recovery
Hygraph
Docs

Conditional fields

During schema creation, field configuration can be set so the field has Conditional visibility. This means that it will only display in the content editor when the condition is met.

If you have access to your project schema, you can find out if a field has a condition configured by looking at the Conditional visibility checkbox in the configuration screen:

Conditional fieldConditional field

The objective of conditional fields is to show only the information you need in the content editor. If you interact with the base field (the field that sets the condition) in a way that fulfils the field's conditional visibility configuration, it will display.

These conditions are applied via using a Boolean or Enumeration field.

#Boolean field

Using the switch in the content editor to indicate True or False might fulfil the condition, depending on what condition was configured.

In the following example the condition says that if the In stock boolean field is set to True, the conditional field will display on the content editor screen:

Conditional field - BooleanConditional field - Boolean

#Enumeration field

Using the enumeration dropdown in the content editor to select one or more options might fulfil the condition, depending on what condition was configured.

In the following example the condition says that if you select Location 2 from the Offers dropdown, the conditional field will display on the content editor screen:

Conditional field - EnumerationConditional field - Enumeration