You can use the Toggle Button UI Pattern to provide users with a stand-alone control that allows them to choose between two states, for example, a Yes/No value.
How to use the Toggle Button UI Pattern
In this example, we create a toggle button to activate a widget that can is activated only when a condition is met.
In Service Studio, in the Toolbox, search for
The Toggle Button widget is displayed.
If the UI widget does not display, it may be because you used a ready-made app, which deletes unused widgets from the module. To make additional widgets available in your app:
a. Go to Module > Manage dependencies.
b. Search for and select the relevant Producer, for example OutSystemsUI. Ensure Show All is selected.
c. On the Public elements for the selected Producer displayed on the right, ensure Show All is selected.
d. Search for and select the element you want to add, and click Apply.
e. In Service Studio, in the Toolbox, search for the widget again.
From the Toolbox, drag the Toggle Button widget into the Main Content area of your application's screen.
Right-click your screen name and select Add Local Variable.
Enter a name and select a data type. In this example, we enter the name
IsToggled, set the data type to Boolean and the default value to False.
In this example, we add some text and a button. We enter a name for the button (SubmitButton), and set the Enabled property to the local variable we created earlier (IsToggled).
Select the Checkbox widget, and on the Properties tab, from the Variable drop-down, select the local variable you just created (in this example, IsToggled).
From the OnChange Destination drop-down, select New Screen Action.
From the Toolbox, add the Ajax Refresh to the screen action, and in the Select Widget pop-up, navigate to and select the Submit button name (in this example, SubmitButton), and click OK.
After following these steps and publishing the module, you can test the pattern in your app.
|ExtendedClass (Text): Optional||Adds custom style classes to the Pattern. You define your custom style classes in your application using CSS.