Skip to main content

Color Picker

A wrapper for the react-color color picker.

Options#

  • variant | string: color picker variant (either Compact, Sketch, Material, or Block). Default: 'Sketch'.
  • color | (string|object): string holding an HeX code or an object holding RGB or HSL values such as { r: 255, g: 255, b: 255 } or { h: 0, s: 0, l: .10 }, which determines the active color. Both accept an a property for alpha values other than one. Default: '#fff'.
  • disableAlpha | boolean: controls whether to remove alpha slider and options. Default: false.
  • presetColors | array<string>: HeX strings specifying the default colors at the bottom of the colorpicker. Default: [ '#D0021B', '#F5A623', '#F8E71C', '#8B572A', '#7ED321', '#417505', '#BD10E0', '#9013FE', '#4A90E2', '#50E3C2', '#B8E986', '#000000', '#4A4A4A', '#9B9B9B', '#FFFFFF' ].
  • width | number: width of the color picker (in px). Default: 200.
  • className | string: class name. Default: ''.
  • style | object: CSS inline styles. Default: {}.
  • onChange | function: callback invoked every time color is changed. Default: onChange() {}.
  • onChangeComplete | function: callback invoked once a color change is complete. Default: onChangeComplete() {}.

Examples#

Live Editor
Result
ReferenceError: Provider is not defined