Skip to main content

 

 

 

 

Template:OutSystems/Documentation_KB/Breadcrumb_New_Layout

 

 

Template:OutSystems/OSLanguageSwitcher

 

Applies only to Traditional Web Apps

 

 

OutSystems

Toggle Button

Template:OutSystems/Documentation_KB/ContentCollaboration
  • Edit
    Collaborate with us
    Edit this page on GitHub
  • 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.

    1. In Service Studio, in the Toolbox, search for Toggle Button.

      The Toggle Button widget is displayed.

    2. From the Toolbox, drag the Toggle Button widget into the Main Content area of your application's screen.

    3. Right-click your screen name and select Add Local Variable.

    4. 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.

    5. 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).

    6. 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).

    7. From the OnChange Destination drop-down, select New Screen Action.

    8. 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.

    Properties

    Property Description
    ExtendedClass (Text): Optional Add custom style classes to the Toggle Button UI Pattern. You define your custom style classes in your application using CSS.

    Examples

    • Blank - No custom styles are added (default value).
    • "myclass" - Adds the myclass style to the Toggle Button UI styles being applied.
    • "myclass1 myclass2" - Adds the myclass1 and myclass2 styles to the Toggle Button UI styles being applied.
    • Was this article helpful?