ColorPicker
Pick colors in hex(a), rgb(a), hsl(a) and hsv(a) formats
Import
Source
Docs
Package
Usage
rgba(47, 119, 150, 0.7)
Color format
ColorPicker
supports hex, hexa, rgb, rgba, hsl and hsla color formats.
Slider to change opacity and color preview are displayed only for hexa, rgba and hsla formats:
#C5D899
With swatches
You can add predefined color swatches with swatches
prop:
By default, ColorPicker
will display 7 swatches per row, you can configure it with swatchesPerRow
prop:
To display swatches without picker set withPicker={false}
and fullWidth
props:
#fff
Size
ColorPicker
has 5 predefined sizes: xs
, sm
, md
, lg
and xl
:
fullWidth
Set fullWidth
prop to stretch component to 100% of parent width. In this case the picker will not
have fixed width, but you can still use size
prop to control sizes of sliders.
Styles API
ColorPicker
supports Styles API, you can add styles to any inner element of the component withclassNames
prop. Follow Styles API documentation to learn more.
Component Styles API
Hover over selectors to highlight corresponding elements
HueSlider component
Hue value: 250
AlphaSlider component
Alpha value: 0.55
Accessibility
ColorPicker component is accessible by default:
- Saturation, hue and alpha sliders are focusable
- When moused is used to interact with the slider, focus is moved to the slider
- All values can be changed with arrows
To make component accessible for screen readers, set saturationLabel
, hueLabel
and alphaLabel
: