Skip to main content

Visibility

Introduction

The visibility component plays a pivotal role in ensuring that Actional Buttons in 1Relation appear at the right time, to the right users, and in the right context. It is primarily structured around two key properties: visual for defining the button's appearance, and condition for setting the logical rules for its display.

Top-Level Properties of visibility

The visibility object is composed of the following top-level properties, each contributing to the button's display logic and appearance:

PropertyTypeRequiredDescription
visualobjectYesContains properties that define the button's visual presentation. It includes settings for the button's text, color, icon, and display preferences.
conditionarrayNoAn array of conditions that dictate when the button is visible. It involves a set of logical expressions evaluated against specific item attributes or user contexts.
popconfirmobjectNoAn optional confirmation dialog that prompts the user to confirm an action before proceeding. This object includes properties to customize the confirmation message, as well as the labels for the confirm and cancel buttons.

Visual Configuration

The visual object within the visibility component defines the aesthetic aspects of the Actional Button.

Properties of visual

PropertyTypeRequiredDefault ValueDescription
textstringYesThe text displayed on the button.
textColorstringNowhiteThe color of the button text.
bgColorstringNoprimaryThe background color of the button.
iconstringNoThe icon displayed on the button. See page about Icons.
displayIconOnlybooleanNofalseIndicates if only the icon is displayed, hiding the button text.
allowMultipleItemsbooleanNofalseIndicates if the button should be enabled when multiple items are selected. Otherwise it will be disabled.
placementstringNowidgetThe placement of the button. Possible values are widget and row.

JSON Example for visual

"visual": {
"text": "Complete Task",
"textColor": "white",
"bgColor": "success",
"icon": "check_circle",
"displayIconOnly": false
}

Condition Configuration

The condition array within the visibility component determines the logical rules for when the Actional Button should be displayed.

Properties of condition

A set of conditions that control the visibility of the button. Each condition is an array of three values: the key, operator, and value to be evaluated. Conditions are documented separeately JSON Query Documentation

JSON Example for condition

"condition": [
["task.cf433", "!=", "option_844"],
["group", "IN", "Sales"]
]

Pop Confirm Configuration

The popconfirm object within the visibility component introduces an additional layer of user interaction by prompting the user to confirm an action before it proceeds. This functionality is critical for actions that have significant effects or cannot be easily undone, ensuring that the user has explicitly consented to the action.

Properties of popconfirm

PropertyTypeRequiredDescription
textstringYesThe message displayed in the confirmation dialog.
nostringNoThe text for the cancellation button. Default is "Cancel".
yesstringNoThe text for the confirmation button. Default is "Confirm".
showbooleanYesControls whether the confirmation prompt should be displayed when the button is pressed.

JSON Example for popconfirm

{
"visibility": {
"visual": {
"text": "Close task",
"textColor": "white",
"bgColor": "success",
"icon": "add",
"displayIconOnly": false
},
"popconfirm": {
"text": "Confirm that the task is done",
"no": "Cancel",
"yes": "Confirm",
"show": true
}
}
}

Overall Visibility Configuration

Combining visual and condition settings, the visibility component as a whole controls when and how an Actional Button is displayed.

JSON Example for visibility

{
"visibility": {
"visual": {
"text": "Complete Task",
"textColor": "white",
"bgColor": "success",
"icon": "check_circle",
"displayIconOnly": false
},
"condition": [
["task.cf433", "!=", "option_844"],
["group", "IN", "Sales"]
]
}
}

In this configuration:

  • The visual settings define the button's appearance, making it visually identifiable and aligned with the application's design.
  • The condition settings ensure that the button appears only under specific circumstances, enhancing the user experience by presenting contextually relevant options.

By configuring the visibility component thoughtfully, you can create Actional Buttons that are both aesthetically pleasing and functionally precise, guiding users effectively through their interactions with your system.

Details the conditions or parameters for interacting with the item. Includes item IDs, parent item IDs, or other relationships as specified in the JSON Query Documentation..