2021-02-05 18:22:23 +00:00
---
title: oh-toggle - Toggle
component: oh-toggle
label: Toggle
description: Toggle control, allows to switch on or off
source: https://github.com/openhab/openhab-webui/edit/main/bundles/org.openhab.ui/doc/components/oh-toggle.md
2021-03-01 14:42:17 +00:00
prev: /docs/ui/components/
2021-02-05 18:22:23 +00:00
---
2021-02-05 14:16:35 +00:00
# oh-toggle - Toggle
2021-03-01 14:42:17 +00:00
<!-- Put a screenshot here if relevant:
![](./images/oh-toggle/header.jpg)
-->
[[toc]]
<!-- Note: you can overwrite the definition - provided description and add your own intro/additional sections instead -->
<!-- DO NOT REMOVE the following comments if you intend to keep the definition - provided description -->
2021-02-05 14:16:35 +00:00
<!-- GENERATED componentDescription -->
Toggle control, allows to switch on or off
<!-- GENERATED /componentDescription -->
## Configuration
2021-03-01 14:42:17 +00:00
<!-- DO NOT REMOVE the following comments -->
2021-02-05 14:16:35 +00:00
<!-- GENERATED props -->
2021-03-01 14:42:17 +00:00
### General
< div class = "props" >
< PropGroup label = "General" >
< PropBlock type = "TEXT" name = "item" label = "Item" context = "item" >
< PropDescription >
Item to control
< / PropDescription >
< / PropBlock >
< PropBlock type = "TEXT" name = "color" label = "Color" >
< PropDescription >
Color of the control (supported values: red, green, blue, pink, yellow, orange, purple, deeppurple, lightblue, teal, lime, deeporange, gray, white, black)
< / PropDescription >
< / PropBlock >
< PropBlock type = "TEXT" name = "variable" label = "Variable" >
< PropDescription >
Name of the variable to set on input change
< / PropDescription >
< / PropBlock >
2022-12-11 11:35:11 +00:00
< PropBlock type = "TEXT" name = "variableKey" label = "Variable Key" >
< PropDescription >
Consider the variable value is an object and set the corresponding deep property within that object using a key syntax. Examples: < code > user.name< / code > , < code > user[0].address[1].street< / code > , < code > [0]< / code > , < code > [0].label< / code > . The inner property and its parent hierarchy will be created if missing.
< / PropDescription >
< / PropBlock >
2021-03-01 14:42:17 +00:00
< / PropGroup >
< / div >
2021-02-05 14:16:35 +00:00
2021-03-01 14:42:17 +00:00
<!-- GENERATED /props -->
2021-02-05 14:16:35 +00:00
2021-03-01 14:42:17 +00:00
<!-- If applicable describe how properties are forwarded to a underlying component from Framework7, ECharts, etc.:
### Inherited Properties
2021-02-05 14:16:35 +00:00
2021-03-01 14:42:17 +00:00
-->
2021-02-05 14:16:35 +00:00
2021-03-01 14:42:17 +00:00
<!-- If applicable describe the slots recognized by the component and what they represent:
### Slots
2021-02-05 14:16:35 +00:00
2021-03-01 14:42:17 +00:00
#### `default`
2021-02-05 14:16:35 +00:00
2021-03-01 14:42:17 +00:00
The contents of the oh-toggle.
-->
<!-- Add as many examples as desired - put the YAML in a details container when it becomes too long (~150/200+ lines):
## Examples
### Example 1
![](./images/oh-toggle/example1.jpg)
```yaml
component: oh-toggle
config:
prop1: value1
prop2: value2
```
### Example 2
![](./images/oh-toggle/example2.jpg)
::: details YAML
```yaml
component: oh-toggle
config:
prop1: value1
prop2: value2
slots
```
:::
-->
<!-- Try to clean up URLs to the forum (https://community.openhab.org/t/<threadID>[/<postID>] should suffice)
## Community Resources
- [Community Post 1 ](https://community.openhab.org/t/12345 )
- [Community Post 2 ](https://community.openhab.org/t/23456 )
-->