(this page was created automatically. In case of formatting issues, please visit the official Wiki Page)

Toggle Switch

Overview

Example Switch

Specs

Tokens

Token Description
disabled Disables user interaction.
value Initial on/off state.
hidden Keeps in form but not visible.
saveInLocalStorage Persists state between sessions.
defaultValue Reset value for form reset.
readonly Shows state but cannot change.
dataField Field name used on submit.
controlsRequestType Where value is sent: BODY, HEADER, or PATH.
authorizationDisable Policy set that disables by permissions.
events Configures component events.
ON_INIT (Events) Runs on component initialization.
ON_DESTROY (Events) Runs when component is removed.
ON_VALUE_CHANGE (Events) Runs when user toggles value.
ON_INIT_BASED_ON_USER_VIEW (Events) Runs on init in user view mode.
dataTestId Testing hook ID.

Structure

(Configured in Non-Visual Properties)

(Configured in Visual Properties)

Actions & Variants

(Configured in Events)

(Configured in Visual Properties)

Different versions

Tests

(Configured in Testing Hooks)

Authorization

(Configured in Authorization Properties)

Links

Guidelines

Usage

Sizing & Layout

States & Feedback

Visibility & Authorization

Dos & Don’ts

Do Don’t
Set a safe initial value and a distinct defaultValue for resets. Reuse one value for both current and reset, causing unexpected form state after reset.
Enable saveInLocalStorage for persistent preferences. Force users to reconfigure the same preference every session.
Use hidden to remove irrelevant controls from view and reading order. Leave a visible but meaningless control on screen.
Prefer authorizationDisable + disabled/readonly to show blocked settings. Hide controls that users should be aware exist but cannot change.
Submit with a clear dataField and correct controlsRequestType. Send the boolean in the wrong channel (e.g., header instead of body).
Handle changes immediately with ON_VALUE_CHANGE. Defer processing until an unrelated action.
Clean up listeners/timers with ON_DESTROY. Leave background work running after navigation.

Accessibility