Skip to content

switch field

The field can be used as a radio button or to select a single value out of two.

  • Keyword switch.


values Optional

  • Type [any, any]. If this parameter is passed, then the included parameter will correspond to values[0] value, and off values[1].

Also all parameters common to all FormField. Information about them can be found on this page.


If the values parameter was not passed, then the value will be true - enabled, false - disabled. In the case where values is passed, the included value will match values[0], and off the remaining value.


  • The field is available when using Tab and Shift + Tab.
  • Selecting an element is possible by clicking on the element itself.
  • The choice is possible by pressing Enter or Space.
  • Blocking fields cancels navigation using Tab. There is also a change in the style of switch.
  • If the validation fails, the field should change the switch style.


There are no additional-required parameters for this field, so we need to specify only type and name:

<form-field name="hasPhone" type="switch"/>
<form-field name="hasPhone" type="switch"/>
import {FormField} from "jenesius-vue-form";
import {FormField} from "jenesius-vue-form";

Default field:

This is an administrator

In locked state:


Field not validated:


Seleact this fields

Field with passed values: ['yes', 'no']

With passed values

The current state of the form:


Released under the MIT License.