Skip to content

Field single-radio

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

Params

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 viewed on this page.

Value

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.

Specification

  • 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 single-radio.
  • If the validation fails, the field should change the single-radio style.

Examples

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

html
<form-field name = "hasPhone" type = "single-radio"/>
<form-field name = "hasPhone" type = "single-radio"/>
ts
import {FormField} from "jenesius-vue-form";
import {FormField} from "jenesius-vue-form";

Default field:

Are you using a phone?


In locked state:

Disabled


Field not validated:

Error

Seleact this fields


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

With values passed


The current state of the form:

ts
{}
{}

Released under the MIT License.