> For the complete documentation index, see [llms.txt](https://docs.blynk.io/en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.blynk.io/en/blynk.console/widgets-console/switch.md).

# Switch

{% hint style="warning" %}
***Note:*** please remember that web and mobile app widgets are set up separately in the Web Dashboard and Mobile App Dashboard sections correspondingly. They can still use the same datastreams to access the same data (Map widget is an exception – a different codebase is used for Map on mobile and web).
{% endhint %}

The Switch widget sends a command and displays the binary status of the device, typically 1 for ON, and 0 for OFF.

<figure><img src="https://files.gitbook.com/v0/b/gitbook-legacy-files/o/assets%2F-MBFTVMf7L6S67HOuqVC%2F-MVLXy69EogCOTmSZVul%2F-MVLrS5w1PFM9F5m44di%2FSwitch.gif?alt=media&#x26;token=50227417-a0a4-4f61-aa7e-182db9df72b4" alt=""><figcaption></figcaption></figure>

### Settings

**Title** - the label shown at the top of the widget when the option ‘Hide widget name’ is not enabled.

**Datastream** - [data type](broken://pages/-MS3zKWJtlX_kqNf6y-l) integer or double may be assigned.

**ON VALUE** - the numeric value you want the datastream value set to when the switch is turned on. Typically the value one (1). The range of values are constrained by the datastream [min value](broken://pages/-MS3yy_t0NucFAmAc-G8) and [max value](broken://pages/-MS3z7SEM67FxKq6UEWL) settings.

**OFF VALUE** - the numeric value you want the datastream value set to when the switch is turned off. Typically the value is zero (0). The range of values are constrained by the datastream [min value](broken://pages/-MS3yy_t0NucFAmAc-G8) and [max value](broken://pages/-MS3z7SEM67FxKq6UEWL) settings.

**Color** - The widget color takes on the assigned datastream color by default.

**Show on/off labels** - adds custom labels to identify the on/off state of the switch. When enabled, you may also right or left justify the label with the ‘LABEL POSITION’ option. The ‘Hide widget name’ hides the display of the ‘Title’ label when enabled.

**ON LABEL** - When the ‘Show on/off labels’ option is enabled, then the ‘ON LABEL’ text assigned will be displayed when the switch widget value equals the ‘ON VALUE’.

**OFF LABEL** - When the ‘Show on/off labels’ option is enabled, then the ‘OFF LABEL’ text assigned will be displayed when the switch widget value equals the ‘OFF VALUE’.

**LABEL POSITION** - When the ‘Show on/off labels’ option is enabled, this option aligns the ‘ON LABEL’ and ‘OFF LABEL’ either to the left or right of the switch.

**Hide widget name** - when enabled, hides the display of the ‘TITLE’ at the top of the widget.

![Switch widget setup demo](https://1839001309-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MBFTVMf7L6S67HOuqVC%2F-MSh_x6ag-ZgeLUqfBfU%2F-MShdm08fxlmzHF9Twkr%2Fswitch_setup.gif?alt=media\&token=ad56e32e-de0f-422d-89fe-7195c1fe51fa)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.blynk.io/en/blynk.console/widgets-console/switch.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
