Constructor
# new Checkbox(config)
Its a Custom Web Component. Do not use the constructor directly with the new keyword. Instead, use one of the 3 following methods:
Create the Web Component and call its init method:
const myCheckbox = document.createElement("a-checkbox").init(config)
Or use the shorthand for it:
const myCheckbox = createCheckbox({
text: "Check me!",
shape: "switch"
})
myCheckbox.render()
Or directly declare the config inside a container component:
const myPanel = createPanel({
title: "My panel",
items: [
{
type: "checkbox",
text: "Check me!",
shape: "switch"
}
]
})
myPanel.render()
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
config |
object
|
||
label |
string
|
||
labelWidth |
string
|
<optional> |
|
labelPosition |
string
|
<optional> |
left | right | top | bottom |
labelAlign |
string
|
<optional> |
left | right |
color |
string
|
<optional> |
|
fontSize |
string
|
<optional> |
|
shape |
string
|
<optional> |
check | square | circle | switch | star |
iconSize |
string
|
<optional> |
|
iconOn |
string
|
<optional> |
|
iconOff |
string
|
<optional> |
|
iconColorOn |
string
|
<optional> |
|
iconColorOff |
string
|
<optional> |
|
formula |
string
|
<optional> |
|
checked |
boolean
|
<optional> |
Default state - Can use "checked" or "value" indifferently |
value |
boolean
|
<optional> |
Default state - Can use "checked" or "value" indifferently |
width |
string
|
number
|
<optional> |
|
height |
string
|
number
|
<optional> |
|
margin |
string
|
<optional> |
|
padding |
string
|
<optional> |
|
readOnly |
boolean
|
<optional> |
|
disabled |
boolean
|
<optional> |
this
Generated markup
<a-checkbox class="a-checkbox">
<label class="field-label"></label>
<span class="field-checkbox-icon font-awesome-icon-class"></span>
<input type="checkbox" class="field-checkbox">
</a-checkbox>
Methods
# setLabelPosition(position)
Set label position
Parameters:
Name | Type | Description |
---|---|---|
position |
string
|
"left" (default) | "right" | "top" | "bottom" |
this
# setValue(newState, rawUpdateopt)
Set the field value
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
newState |
boolean
|
The new field value |
|
rawUpdate |
boolean
|
<optional> |
If true, it doesn't update the associated record and doesn't trigger "change" event |
this