viaSocket Help
Integration Guides

Visibility Condition

The Visibility Condition is a JavaScript expression that controls whether an input field is shown or hidden in the plugin's UI. It runs dynamically based on the current values of other fields.


#

Where does it live?

Each input field in the Developer Hub Input Builder can have a visibilityCondition attached to it. It appears as a collapsible code editor under the field's configuration.


#

How does it work?

The condition is evaluated as a JavaScript expression that must return a boolean:

  • true → field is visible

  • false → field is hidden

It has access to a context object containing the current values of all other fields via context.inputData:

context.inputData.fieldKey // value of another field


#

How to write one

Basic example — show field only when another field equals a specific value:

context.inputData.auth_type === 'oauth'

Multiple conditions:

js
context.inputData.auth_type === 'oauth' && context.inputData.client_id !== ''

Always visible (default):

js
true

Always hidden:

js
false

Based on a field having any value:

js
!!context.inputData.some_field

#

Key rules

  • Must be a single expression that evaluates to a boolean (no return keyword needed)

  • References other fields via context.inputData.<fieldKey> where fieldKey is the field's unique key

  • If the condition throws an error, the field defaults to visible

  • If no condition is set, the field is always visible


#

Testing it

Use the Test button in the visibility condition editor — it evaluates the condition against the current field values and shows the result (true/false) in the response panel below.