Skip to content
On this page

NcColorPicker

Props

Prop nameDescriptionTypeValuesDefault
modelValueA HEX color that represents the initial value of the pickerstring-
advancedFieldsSet to true to enable advanced fields including HEX, RGB, and HSLboolean-false
paletteProvide a custom array of hexadecimal colors to showarray-() => GenColors(4).map(color => {
return '#' + rgbToHex(color.r) + rgbToHex(color.g) + rgbToHex(color.b)
})

Events

Event namePropertiesDescription
submitEmits a hexadecimal string e.g. '#ffffff'
closeEmitted after picker close
update:open
update:modelValueEmits a hexadecimal string e.g. '#ffffff'
inputEmits a hexadecimal string e.g. '#ffffff'

Slots

NameDescriptionBindings
default

As this component is based on the NcPopover component, it also inherits all props and events from it.

General description

This component allows the user to choose a color. It consists of 2 actual pickers:

  • One simple picker with a predefined palette of colors;
  • One more advanced picker that provides the full color spectrum;

Usage

  • Using v-model and passing in an HTML element that will be treated as a trigger:
loading...
  • Using v-model for both color and open state and emitting an event that updates the color
loading...
  • Using advanced fields including HEX, RGB, and HSL:
loading...