# Switch
### Install
```js
import Vue from 'vue';
import { Switch } from 'vant';
Vue.use(Switch);
```
## Usage
### Basic Usage
```html
```
```js
export default {
data() {
return {
checked: true,
};
},
};
```
### Disabled
```html
```
### Loading
```html
```
### Custom Size
```html
```
### Custom Color
```html
```
### Async Control
```html
```
```js
export default {
data() {
return {
checked: true,
};
},
methods: {
onUpdateValue(checked) {
Dialog.confirm({
title: 'Confirm',
message: 'Are you sure to toggle switch?',
}).then(() => {
this.checked = checked;
});
},
},
};
```
### Inside a Cell
```html
```
## API
### Props
| Attribute | Description | Type | Default |
| --- | --- | --- | --- |
| v-model | Check status of Switch | _ActiveValue \| InactiveValue_ | `false` |
| loading | Whether to show loading icon | _boolean_ | `false` |
| disabled | Whether to disable switch | _boolean_ | `false` |
| size `v2.2.11` | Size of switch | _number \| string_ | `30px` |
| active-color | Background color when active | _string_ | `#1989fa` |
| inactive-color | Background color when inactive | _string_ | `white` |
| active-value | Value when active | _any_ | `true` |
| inactive-value | Value when inactive | _any_ | `false` |
### Events
| Event | Description | Parameters |
| --------------- | ----------------------------------- | -------------- |
| change | Triggered when check status changed | _value: any_ |
| click `v2.2.11` | Triggered when clicked | _event: Event_ |