On/off switches toggle the state of a single settings option. The option that the switch controls, as well as the state it’s in, should be made clear from the corresponding inline label. Vue material switches can work with multiple v-model
types: String
, Number
, Boolean
and Array
.
Array | Boolean | String | No Value |
---|---|---|---|
[] | false |
The following options can be applied to all switches:
Name | Description | Default |
---|---|---|
value String|Number|Boolean | The value of the switch | on |
v-model String|Number|Boolean|Array | The model variable to bind the selection value. If array, it will toggle values inside of it. If no value is assigned, then it will use the same behaviour of a regular input[type="checkbox"]. | null |
id String | The switch unique id. | a random string |
<input type="checkbox">
attributes, such as name and required, can be used on md-switch
.