How to Conditionally Show Components
- Components can be hidden until a condition is met
- One example of this is wanting to show additional components when a particular value is chosen in a select component
- You will need access to the advanced editor to set this up
Video explanation
Steps to set up
Scenario: Hide a "Status Update" text field unless the user selects "High Priority”.
- In a workflow create a select component (for “Low Priority” and “High Priority” and a text component (for the status update).
- This can be done in the No-Code Builder.
- Open up the advanced editor.
- Navigate to the select component by clicking on Steps > {step name} > {task name} > Layouts > {layout name} > {section name} > {select component name}.
- Copy the value in the “dataPath” value from the select component.
- e.g. from “dataPath”: “$.taskOne.selectComponent” you would copy “$.taskOne.selectComponent”.
- Navigate to the text component.
- Change this property on the text component.
- “condition”: “’{$.taskOne.selectComponent}’ == ‘High Priority’”
- Paste the dataPath for the select component.
- Notice how both the dataPath and the value are wrapped in ‘single quotation marks’.
- Notice how the dataPath is wrapped in {}.
- Notice how two == are used.
- Check there are no validation errors and then exit out of the Advanced Editor.
- Your progress will be saved automatically.
- Publish your workflow.
- Done 🎉
- Now when you start a new work item the text component will be hidden until you select the “High Priority” option on the select component.