Field checkbox
The field is used for multiple selection of values from the provided set.
- Keyword
checkbox. - WhatWG Спецификация.
Params
options Required
- Type: FormFieldOptions.
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
TabandShift + Tab. - Navigation is not available by pressing
ArrowDownandArrowUp. - Selecting an element is possible by clicking on the corresponding element, as well as by pressing
EnterorSpacewhile on the desired element. - Blocking fields cancels navigation using
Tab. There is also a change in the style ofcheckbox. - If the validation fails, the field should change the
checkboxstyle.
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
{}{}