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
placeholderstringText that appears in the input element when it has no value set
requiredbooleanRequire the field to be completed prior to form submission.
saved-colors-keystringSets the localStorage key used to store saved colors explicitly
success-textstringProvides a custom success message. Any current error state will be overridden.
swatches{label?: string; value: string}[]List of color swatches, has to be an array of objects
valuestringThe current value of the element.

Events

NameEvent TypeDescription
changeCustomEvent<undefined>Fires when the value changes
inputEventFires when the value of the element changes.

Slots

NameDescription
contextual-helpSlot for the contextual-help component, displayed next to the label.
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.