Checkbox Element
An element used to render checkbox input.
#Examples
<script>
export default {
mixins: [Laraform],
data: () => ({
schema: {
checkbox: {
type: 'checkbox',
text: 'Check'
},
checkbox2: {
type: 'checkbox',
text: 'Check',
default: true
},
checkbox3: {
type: 'checkbox',
text: 'Check',
disabled: true
},
checkbox4: {
type: 'checkbox',
text: 'Check',
default: true,
disabled: true
},
}
})
}
</script>
<script>
export default {
mixins: [Laraform],
data: () => ({
schema: {
checkbox5: {
type: 'checkbox',
text: 'Check'
},
},
buttons: [
{
label: 'Check',
prevent: true,
class: 'btn-primary btn-xs',
onClick() {
this.form$.el$('checkbox5').check()
}
},
{
label: 'Uncheck',
prevent: true,
class: 'btn-primary btn-xs',
onClick() {
this.form$.el$('checkbox5').uncheck()
}
},
{
label: 'Disable',
prevent: true,
class: 'btn-primary btn-xs',
onClick() {
this.form$.el$('checkbox5').disable()
}
},
{
label: 'Enable',
prevent: true,
class: 'btn-primary btn-xs',
onClick() {
this.form$.el$('checkbox5').enable()
}
},
]
})
}
</script>
#Options
Name | Type | Description |
---|---|---|
text | string |
Text appears next to the checkbox. |
trueValue | str|num|bool |
Value of the element if checkbox is checked. |
falseValue | str|num|bool |
Value of the element if checkbox is unchecked. |
default | string |
Value of element when the form is initially loaded or reseted. |
disabled | boolean |
Whether the field is disabled. |
#Properties
Name | Type | Default | Description |
---|---|---|---|
disabled | boolean |
false |
Whether the field is disabled. |
text | string |
null |
Text appears next to the checkbox. |
trueValue | str|num|bool |
true |
Value of the element if checkbox is checked. |
falseValue | str|num|bool |
false |
Value of the element if checkbox is unchecked. |
defaultValue | str|num|bool |
null |
Value of element when the form is initially loaded or reseted. |
#Methods
# .disable()
Disabled the field.
# .enable()
Enables the field.
# .check()
Checks the checkbox.
# .uncheck()
Unhecks the checkbox.