require(["esri/dijit/ColorPicker"], function(ColorPicker) { /* code goes here */ });
Description
(Added at v3.13)
A widget to assist choosing a color from a color palette.
Samples
Search for
samples that use this class.
Constructors
CSS
esri/dijit/ColorPicker | Download source
Properties
Methods
startup() | None | Finalizes the creation of the widget. |
Events
[ On Style Events | Connect Style Event ]
All On Style event listeners receive a single event object. Additionally, the event object also contains a 'target' property whose value is the object which fired the event.
Constructor Details
Creates a new ColorPicker
widget.
Parameters:
<Object > params |
Required |
Set of parameters used to specify the ColorPicker widget options. |
<Node | String > srcNodeRef |
Required |
Reference or ID of the HTMLElement where the widget should be rendered. |
params
properties:
<Boolean > collapsed |
Optional |
Indicates whether the widget displays collapsed. Default value is false. |
<Boolean > collapsible |
Optional |
Indicates whether the widget can be collapsed. Default value is false. |
<Color > color |
Required |
The selected color. If no color is provided, the first color from the palette is selected by default. |
<Number > colorsPerRow |
Optional |
The row size of the palette. Default is 13 . |
<Color[] > palette |
Optional |
The set of available color options. By default, a palette of 78 colors is provided. |
<Color[] > recentColors |
Optional |
Array of recent colors to show in the recent colors row. |
<Boolean > required |
Optional |
Toggles color selection being required. When false , the no-color swatch is available. Default is false . |
<Boolean > showRecentColors |
Optional |
Toggles the recent color row. Default is true . |
<Boolean > showTransparencySlider |
Optional |
Toggles the transparency slider. Default is true . |
Sample:
require(["esri/dijit/ColorPicker", ...
], function(ColorPicker, ... ) {
var colorPicker = new ColorPicker(params, srcNodeRef);
...
});
Property Details
Indicates whether the widget displays collapsed. (Added at v3.22)
Default value: false
Indicates whether the widget is collapsible. (Added at v3.22)
Default value: false
The set of available color options.
An array of recent colors to show in the recent colors row.
Method Details
Finalizes the creation of the widget.
Event Details
[ On Style Events | Connect Style Event ]
Fires when the selected color has changed.