Webcomponent
Form
Controls
Color Swatches Control
h-color-swatches-control
Color Swatches Control
This webcomponent can be used as a wrapper for color-swatches to use it as a form element. It adds error handling and hidden input fields which holds color-swatches return value.
Attributes
Attribute name
Type
Default
Description
control-id
string
''
control-name
string
''
disabled
(optional)
boolean
false
required
(optional)
boolean
false
error
(optional)
boolean
false
If set to true, adds css error class
Public properties
Property name
Return type
Description
name
string
Returns control name
id
string
Returns control id
Public methods
Method name
Parameters
Return type
Description
selectColors()
string[ ]
void
Select or deselect colors according to the passed parameter (array of hex colors)
clearAllColors()
null
void
Clear all selected colors
DOM Events
This webcomponent listens to the following DOM events :
Example