Skip to content

Field checkbox

The field is used for multiple selection of values from the provided set.

Params

options Required

The set of possible field values.


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

Value

The value is an array containing the value of the selected elements, because the field is intended for multiple selection.

Specification

  • Navigate the object by pressing Tab and Shift + Tab.
  • Navigation is not available by pressing ArrowDown and ArrowUp.
  • Selecting an element is possible by clicking on the corresponding element, as well as by pressing Enter or Space while on the desired element.
  • Blocking fields cancels navigation using Tab. There is also a change in the style of checkbox.
  • If the validation fails, the field should change the checkbox style.

Examples

To connect the widget, use the standard FormField component, and you also need to specify the type and name attributes:

vue
<template>
	<form-field
		name = "color"
		type = "checkbox"
		label = "Color"
		:options = "options"
	/>
</template>
<script setup>
import {FormField} from "jenesius-vue-form";

const options = {
	r: "Red",
	g: "Green",
	y: "Yellow"
}

</script>
<template>
	<form-field
		name = "color"
		type = "checkbox"
		label = "Color"
		:options = "options"
	/>
</template>
<script setup>
import {FormField} from "jenesius-vue-form";

const options = {
	r: "Red",
	g: "Green",
	y: "Yellow"
}

</script>

Field in normal state:

Select color

Red

Green

Yellow


View of the field when it is blocked:

Disabled status

Red

Green

Yellow


Field type in case of validation error:

With Error

Red

Green

Yellow

Seleact all options


The current state of the form:

ts
{}
{}

Released under the MIT License.