Skip to content

VColorPicker

Props

NameTypeDescription
disable-saved-colorsbooleanDisables the saving colors functionality
disabledbooleanSets the element's disabled state. A disabled element will not be included during form submission.
error-textstringProvides a custom error message. Any current error state will be overridden.
helper-textstringProvides additional information to help the user enter the correct information. To add HTML to the helper text, use the helper-text slot instead.
initial-valuestringThe default value of the element. This value sets the value property only when the value property has not been explicitly set.
labelstringThe label for the form element.
max-swatchesnumberLimits number of swatches that can be saved.
namestringThe name of the element. This element's value will be surfaced during form submission under the provided name.
openbooleanIndicates whether the popup is open
placeholderstringSets the placeholder value of the element, generally used to provide a hint to the user.
requiredbooleanRequire the field to be completed prior to form submission.
saved-colors-keystringSets the localStorage saved colors key explicitly.
success-textstringProvides a custom success message. Any current error state will be overridden.
swatchesArray<{ value: string; label?: string }>List of color swatches, has to be an array of objects.
valuestringThe current value of the element.

Events

NameEvent TypeDescription
blurFocusEventFires when the element loses focus.
changeCustomEvent<undefined>Fires when the value changes
clickMouseEventFires when a pointing device button (such as a mouse's primary mouse button) is both pressed and released while the pointer is located inside the element.
focusFocusEventFires when the element receives focus.
inputEventFires when the value of an element has been changed.
keydownKeyboardEventFires when a key is pressed.
keyupKeyboardEventFires when a key is released.

Slots

NameDescription
helper-textDescribes how to use the text-field. Alternative to the helper-text attribute.
popup-textOverrides the default "Color Picker" title of the Popup window.
swatches-textOverrides the default "Saved colors:" text above color swatches.

Methods

NameTypeDescription
checkValidity() => booleanReturn the current validity of the element.
reportValidity() => booleanReturn the current validity of the element. If false, fires an invalid event at the element.