# Switch

### Usage

* If you need to represent the switching between two states or on-off state.
* The difference between Switch and Checkbox is that Switch will trigger a state change directly when you toggle it, while Checkbox is generally used for state marking, which should work in conjunction with submit operation.

### States

![](https://3606779243-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDSuDatsiBSDcGYiS7br6%2Fuploads%2FABhh9githN0Z8zsSU11O%2FSw%201.png?alt=media\&token=3769a589-4010-4e5c-84c1-c9825cd3b0f2)

### Specs

![](https://3606779243-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDSuDatsiBSDcGYiS7br6%2Fuploads%2FwiCB1TKGaThD1f8JAfmM%2FSw%202.png?alt=media\&token=a73367ad-12c9-4e5b-88f5-dd93840605ca)

### Sample code

```
// Some code
```
