Color picker
Vue Color Picker
Color Picker plugin allows you to select different colors. You can successfully use it in various product wizards, clothing sales, or other situations where you need to be able to choose a color.
Note: Read the API tab to find all available options and advanced customization
Native color picker
If you need the simplest form - use a native color picker.
Advanced color picker - basic example
The Advanced Color Picker can be placed anywhere on the page. You can initialize it by
adding advanced
prop to the MDBColorPicker
component.
Disable state example
To add a Color picker as read-only use disabled
prop in the
MDBColorPicker
component.
Swatches
You can add ready-made samples for the user. Put
swatches
prop in MDBColorPicker
component and pass an array of
colors in that prop . If you want to add colors in several columns, add them in separate
tables.
Swatches Height
If the defined samples take up a lot of space, you can set their maximum height using
the swatchesHeight
prop.
Default value
To set the default value use the defaultValue
prop.
Dropdown
You can use color picker as dropdown, just add dropdown
prop to
MDBColorPicker
.
Disable section
If you want to use only some picker elements you can disable unnecessary elements. The
following example shows the use of the disableColorPalette
prop. Other
options can be found in the API tab.
Color picker - API
Import
Properties
Properties can be passed to the MDBColorPicker
component.
Name | Type | Default | Description |
---|---|---|---|
tag
|
String | div |
Defines tag of the MDBColorPicker component |
disableColorPickerInputs
|
Boolean | false |
Add disableColorPickerInputs prop to hide the input sections |
disableChangeFormat
|
Boolean | false |
Add disableChangeFormat prop to hide the change color type icons |
disableCopyIcon
|
Boolean | false |
Add disableCopyIcon prop to hide copy code icon |
disableColorPalette
|
Boolean | false |
Add disableColorPalette prop to hide color palette |
swatches
|
Array | [] |
By adding swatches props to MDBColorPicker you are able to define the colors of the swatches |
swatchesHeight
|
Number | 0 |
swatchesHeight prop allow you to define swatches max height |
defaultValue
|
Boolean / String | false |
By adding defaultValue prop you can set default color value |
disabled
|
Boolean | false |
Add disabled prop to use read-only Color picker |
dropdown
|
Boolean | false |
Add dropdown prop to use color picker as dropdown |
dropdownBtnName
|
String | Close |
Add dropdownBtnName prop to change the text in the dropdown button |
disableHue
|
Boolean | false |
Add disableHue prop to remove the hue range input |
disableAlpha
|
Boolean | false |
Add disableAlpha prop to remove the alpha range input |
disableAlphaRangeInput
|
Boolean | false |
Add disableAlphaRangeInput prop to disable the alpha range input |
disableHueRangeInput
|
Boolean | false |
Add disableHueRangeInput prop to disable the hue range input |
removeAlphaInput
|
Boolean | false |
Add removeAlphaInput prop to remove the alpha input |
colorFormat
|
String | "hsla" |
Add colorFormat prop to set a default color format |
Events
Name | Description |
---|---|
onOpen
|
Emitted when Color picker dropdown is open. |
onClose
|
Emitted when Color picker dropdown is close. |
onChange
|
Emitted when the color is changed. |