File: colorpicker.md | Updated: 11/15/2025
Introducing PrimeReact v11 Alpha 🥁Learn More
SearchK
10.9.7
FEATURES
API
THEMING
PASS THROUGH
ColorPicker is an input component to select a color.
Import#
import { ColorPicker } from 'primereact/colorpicker';
Copy
Basic#
ColorPicker is used as a controlled input with value and onChange properties.
<ColorPicker value={color} onChange={(e) => setColor(e.value)} />
Copy
Inline#
ColorPicker is displayed as a popup by default, add inline property to customize this behavior.
<ColorPicker value={color} onChange={(e) => setColor(e.value)} inline />
Copy
Format#
Default color format to use in value binding is hex and other possible values can be rgb and hsb using the format property.
HEX
6466f1
RGB
{"r":100,"g":102,"b":241}
HSB
{"h":239,"s":59,"b":95}
<ColorPicker format="hex" value={colorHEX} onChange={(e) => setColorHEX(e.value)} />
<ColorPicker format="rgb" value={colorRGB} onChange={(e) => setColorRGB(e.value)} />
<ColorPicker format="hsb" value={colorHSB} onChange={(e) => setColorHSB(e.value)} />
Copy
Disabled#
When disabled is present, the element cannot be edited and focused.
<ColorPicker disabled />
Copy
Accessibility#
Specification does not cover a color picker yet and using a semantic native color picker is not consistent across browsers so currently component is not compatible with screen readers. In the upcoming versions, text fields will be introduced below the slider section to be able to pick a color using accessible text boxes in hsl, rgba and hex formats.
| Key | Function | | --- | --- | | tab | Moves focus to the color picker button. | | space | Opens the popup and moves focus to the color slider. |
| Key | Function | | --- | --- | | enter | Selects the color and closes the popup. | | space | Selects the color and closes the popup. | | escape | Closes the popup, moves focus to the input. |
| Key | Function | | --- | --- | | arrow keys | Changes color. |
| Key | Function | | --- | --- | | up arrow__down arrow | Changes hue. |
Import
Basic
Inline
Format
Disabled
Accessibility
PrimeReact 10.9.7 by PrimeTek