Color Picker Component New
The Ignite UI for React Color Picker is a form-associated component that lets users pick and edit a color through an interactive dropdown with a gradient canvas, hue and alpha sliders, format switching, an eye-dropper, and predefined swatches.
Live Demo
The React Color Picker demo shows the anchor in input mode that previews the currently selected color and opens a dropdown where you can edit or select a different color.
Anatomy
The React Color Picker is composed of an anchor that opens a popover dropdown containing the picker surface — a gradient canvas, hue and alpha sliders, format-aware color inputs, action buttons, and an optional swatch grid.
1. Input mode: The Color Picker rendered with
mode="input".2. Color anchor/Fill: Triggers the picker dropdown and shows the currently selected color.
3. Label: The label for the input color picker.
4. Placeholder: The pattern of the active format, such as
#rrggbb, shown while the input is empty.5. Suffix Container: The container for suffix elements, such as action buttons.
6. Hint: The hint text for the input color picker.
B - Default Color Picker
1. Color anchor: Triggers the picker dropdown.
2. Fill: Shows the currently selected color.
3. Label: The label for the color picker.
4. Hint: The hint text for the color picker.
C - Color Picker Dropdown
1. Color Picker dropdown: The popover containing all color selection controls.
2. Gradient canvas: An HSV saturation/value area with a draggable marker.
3. Color Picker marker: A draggable marker that indicates the currently selected color on the gradient canvas.
4. Hue slider: A range slider for the base color.
5. Hue slider handle: A draggable marker that indicates the currently selected hue on the hue slider.
6. Copy button: Copy the currently selected color to the clipboard.
7. Eye-dropper button: Activate the eye-dropper tool for selecting colors from the screen.
8. Alpha slider: An optional opacity slider, shown when
show-alpha is set.9. Alpha slider handle: A draggable marker that indicates the currently selected alpha value on the alpha slider.
10. Opacity value: The currently selected opacity value on the alpha slider.
11. Format switcher: A dropdown for selecting the color format (
hex, rgb, hsl).12. Color value: The currently selected color value displayed according to the chosen format (
hex, rgb, hsl).13. Swatches: An optional grid of predefined color swatches.
<igc-color-picker>
└── ::part(color-picker)
├── igc-popover
│ ├── ::part(anchor) // trigger button (default mode) or swatch button in the input prefix (input mode)
│ │ // also ::part(empty) with no value, ::part(input-mode) in input mode
│ └── ::part(picker) // dropdown, role="dialog"
│ ├── ::part(picker-canvas) // gradient canvas
│ │ └── ::part(marker) // focusable slider; also ::part(dragging) while dragged
│ ├── ::part(main-row)
│ │ ├── ::part(hue) // hue range slider
│ │ └── ::part(buttons)
│ │ ├── ::part(copy) // copy-to-clipboard button
│ │ └── ::part(eye-dropper) // eye-dropper button
│ ├── ::part(alpha-row) // rendered when show-alpha is set
│ │ ├── ::part(alpha) // alpha range slider
│ │ └── ::part(alpha-input) // alpha percentage input
│ ├── ::part(inputs-row)
│ │ ├── ::part(format-select) // format switcher, hidden when hide-formats is set
│ │ └── color value input
│ └── ::part(swatches) // rendered when swatches is non-empty
│ └── ::part(swatch) // individual swatch buttons
├── ::part(label) // default mode, rendered when label is set
└── helper text and validation messages
Getting Started
To use the React Color Picker, complete the Ignite UI for React Getting Started topic for the basic project setup, then register the component.
The Color Picker requires igniteui-react 19.9.0 or later.
Import the IgrColorPicker wrapper and a theme:
import { IgrColorPicker } from 'igniteui-react';
import 'igniteui-webcomponents/themes/light/bootstrap.css';
Render the Color Picker with a label:
<IgrColorPicker label="Pick a color"></IgrColorPicker>
Usage
Set value to any CSS color string: hex (with or without the leading #), rgb/rgba, hsl/hsla, or a named color. An empty or invalid string clears the value, and the anchor shows a checkered pattern.
<IgrColorPicker value="#1976d2"></IgrColorPicker>
Mode
The mode property controls the anchor presentation. Its default value, default, renders a trigger button that previews the current color; input renders an editable text field with a color swatch prefix. Both anchors open the same picker dropdown.
<IgrColorPicker mode="input" label="Background"></IgrColorPicker>
Format
Use the format property to control how the color is serialized. Supported values are hex, rgb, and hsl. Changing the format re-serializes the existing color without altering it, so no igcInput or igcChange event is emitted.
<IgrColorPicker format="rgb" value="#1976d2"></IgrColorPicker>
To hide the built-in format switcher and lock the picker to a single format, set the hideFormats property.
<IgrColorPicker hideFormats={true} format="hex"></IgrColorPicker>
Alpha
By default the picker edits fully opaque colors. Enable the alpha slider and its percentage input by setting the showAlpha property.
<IgrColorPicker showAlpha={true} value="rgba(25, 118, 210, 0.5)"></IgrColorPicker>
Swatches
Provide a list of predefined colors through the swatches property. When set, the picker renders a swatch grid below the color inputs. Clicking a swatch applies it as the current color. There is no limit to the number of swatches you can define.
<IgrColorPicker swatches={['#f44336', '#e91e63', '#9c27b0', '#3f51b5', '#2196f3', '#4caf50']}></IgrColorPicker>
Disabled
Set the disabled property to disable the Color Picker.
<IgrColorPicker disabled={true} value="#1976d2"></IgrColorPicker>
Validation
Mark the control as required to fail form validation when no color is selected. The component supports the standard form-associated API — checkValidity, reportValidity, and setCustomValidity.
Show helper and validation messages under the anchor through these slots:
helper-text– Displays a hint or instructional message below the anchor.value-missing– Renders custom content when the required field validation fails.invalid– Renders custom content when the component is in an invalid state.custom-error– Displays content when a custom validation message is set usingsetCustomValidity().
<IgrColorPicker required={true} label="Brand color">
<span slot="helper-text">Pick the primary brand color.</span>
<span slot="value-missing">A color is required.</span>
</IgrColorPicker>
Size
Control the Color Picker size by setting the --ig-size variable to one of three options: --ig-size-small, --ig-size-medium, or --ig-size-large. This can be used to adjust the size of both the default and input mode anchors, as well as the dropdown window.
Do/Don’t
When to use: Use the Color Picker when users need to enter or edit an arbitrary color through a visual editor and the value must take part in form submission and validation. Always provide a clear label, and prefer input mode when the picker sits alongside other form fields.
When not to use: When users only choose from a small fixed set of colors, render that set as regular buttons or a select instead.
![]() | ![]() |
| Do | Don’t |
Bring in the full Color Picker for open-ended, creative tasks — a drawing tool’s brush, an illustration fill, a chart series, a custom theme. | Avoid using the Color Picker if users only need to select from a set palette or don’t require advanced customization options. |
Properties
The React Color Picker exposes properties for its content, presentation, and form association.
| Name | Type | Default | Description |
|---|---|---|---|
value |
string |
'' |
The current color, serialized in the active format. |
label |
string |
— | The label of the anchor. In mode="input" it is forwarded to the anchor input’s own label. |
format |
'hex' | 'rgb' | 'hsl' |
'hex' |
The output format used when serializing the value string. |
mode |
'default' | 'input' |
'default' |
Whether the anchor is a trigger button (default) or an editable text field with a swatch prefix (input). |
swatches |
string[] |
[] |
Predefined color strings rendered as a selectable swatch grid. |
hideFormats |
boolean |
false |
Whether to hide the format switcher. |
showAlpha |
boolean |
false |
Whether to show the alpha slider and its percentage input. |
required |
boolean |
false |
Whether the control is required for form validation. |
disabled |
boolean |
false |
The disabled state of the control. |
open |
boolean |
false |
The open state of the picker dropdown. |
name |
string |
— | The name of the control for form submission. |
invalid |
boolean |
false |
Sets or returns the invalid visual state of the control. |
Methods
| Name | Return type | Description |
|---|---|---|
show |
Promise<boolean> |
Opens the picker dropdown without emitting igcOpening or igcOpened. |
hide |
Promise<boolean> |
Closes the picker dropdown without emitting igcClosing or igcClosed. |
toggle |
Promise<boolean> |
Toggles the open state of the picker dropdown without emitting events. |
checkValidity |
boolean |
Checks the validity of the control without showing a message. |
reportValidity |
boolean |
Checks the validity of the control and reports it to the user. |
setCustomValidity |
void |
Sets a custom validation message. Pass an empty string to clear. |
Events
| Name | Cancelable | Detail | Description |
|---|---|---|---|
igcInput |
No | string |
Emitted on every interim change from the gradient canvas, the hue and alpha sliders, the alpha input, a swatch, or the eye-dropper. |
igcChange |
No | string |
Emitted when focus leaves the component and the color differs from the one it had when focus entered. |
igcOpening |
Yes | void |
Emitted just before the user opens the picker dropdown. Cancel with event.preventDefault(). |
igcOpened |
No | void |
Emitted after the user opens the picker dropdown. |
igcClosing |
Yes | void |
Emitted just before the user closes the picker dropdown. Cancel with event.preventDefault(). |
igcClosed |
No | void |
Emitted after the user closes the picker dropdown. |
Styling
The React Color Picker appearance can be customized through CSS variables, CSS parts and the theming system.
Styling Variables
| Variable | What it changes |
|---|---|
--ig-color-picker-label-color |
Color of the color picker label. |
--ig-color-picker-label-color-invalid |
Color of the label when the component is invalid. |
--ig-color-picker-label-color-disabled |
Color of the label when the component is disabled. |
--ig-color-picker-anchor-background |
Background color of the color picker anchor. |
--ig-color-picker-anchor-background-hover |
Background color of the anchor on hover. |
--ig-color-picker-anchor-background-focus-visible |
Background color of the anchor when focus is visible. |
--ig-color-picker-anchor-background-focus-visible-hover |
Background color of the anchor when focus is visible and it is hovered. |
--ig-color-picker-anchor-background-active |
Background color of the anchor while active. |
--ig-color-picker-anchor-background-active-focus-visible |
Background color of the anchor while active with visible focus. |
--ig-color-picker-anchor-background-disabled |
Background color of the anchor when disabled. |
--ig-color-picker-anchor-outline-color |
Focus-visible outline color of the anchor. |
--ig-color-picker-anchor-border-color |
Border color of the anchor. |
--ig-color-picker-anchor-border-color-disabled |
Border color of the anchor when disabled. |
--ig-color-picker-anchor-border-radius |
Border radius of the anchor. |
--ig-color-picker-swatch-preview-border-color |
Border color of the color preview inside the anchor. |
--ig-color-picker-picker-background |
Background color of the picker dropdown. |
--ig-color-picker-picker-border-color |
Border color of the picker dropdown. |
--ig-color-picker-picker-border-radius |
Border radius of the picker dropdown. |
--ig-color-picker-picker-canvas-border-color |
Border color of the picker gradient canvas. |
--ig-color-picker-picker-elevation |
Shadow of the picker dropdown. |
--ig-color-picker-slider-track-border-color |
Border color of the hue and alpha slider tracks. |
--ig-color-picker-slider-track-border-radius |
Border radius of the hue and alpha slider tracks. |
--ig-color-picker-slider-thumb-border-color |
Border color of the hue and alpha slider thumbs. |
--ig-color-picker-swatch-separator-color |
Color of the separator above the swatch grid. |
--ig-color-picker-swatch-border-color |
Border color of the predefined color swatches. |
--ig-color-picker-swatch-border-radius |
Border radius of the predefined color swatches. |
--ig-color-picker-swatch-size |
Size of the predefined color swatches. |
--ig-color-picker-transparency-grid-odd |
Odd checker color in the transparency grid. |
--ig-color-picker-transparency-grid-even |
Even checker color in the transparency grid. |
--ig-color-picker-invalid-color |
Color used for invalid-state indicators. |
--ig-color-picker-marker-size |
Size of the marker on the picker gradient canvas. |
--ig-color-picker-marker-elevation |
Shadow of the marker on the picker gradient canvas. |
--ig-color-picker-marker-color |
Color of the marker on the picker gradient canvas. |
Style Parts
| Part | What it styles |
|---|---|
color-picker |
The wrapper around the anchor, label, and helper text. |
anchor |
The trigger element that opens the picker (the button in default mode, or the swatch prefix in input mode). |
empty |
Applied alongside anchor when no color value is set, rendering a checkered background. |
input-mode |
Applied alongside anchor in input mode. |
label |
The label rendered above the anchor in default mode. |
picker |
The popover container holding the canvas, sliders, inputs, and swatches. |
picker-canvas |
The gradient canvas. |
marker |
The draggable marker on the gradient canvas. |
dragging |
Applied alongside marker while the marker is being dragged. |
main-row |
The row containing the hue slider and the copy/eye-dropper buttons. |
alpha-row |
The row containing the alpha slider and input, rendered when show-alpha is set. |
alpha-input |
The alpha percentage input. |
inputs-row |
The row containing the format select and the color value input. |
buttons |
The wrapper around the copy and eye-dropper buttons. |
hue |
The hue range slider. |
alpha |
The alpha (opacity) range slider. |
copy |
The copy-to-clipboard icon button. |
eye-dropper |
The eye-dropper icon button. |
format-select |
The select control used to switch the color string format. |
swatches |
The container of predefined color swatches. |
swatch |
An individual predefined color swatch button. |
Sass Theming
Use the color-picker-theme function for customizing the appearance of the Color Picker through Sass.
@use "igniteui-theming/sass/themes" as *;
$custom-color-picker-theme: color-picker-theme(
$picker-background: #e6f2ff,
$picker-border-color: #a9b8cc,
$picker-border-radius: 1rem
);
:root {
@include tokens($custom-color-picker-theme);
}
CSS Variables
Set component CSS variables directly when you need local styling without a Sass build step.
igc-color-picker {
--ig-color-picker-picker-background: #e6f2ff;
--ig-color-picker-picker-border-color: #a9b8cc;
--ig-color-picker-picker-border-radius: 1rem;
--ig-color-picker-picker-elevation: none;
}
igc-color-picker::part(picker-canvas) {
border-radius: 1rem;
}
Styling with Tailwind
Style the Color Picker with the custom Tailwind utility classes from igniteui-theming. Set up Tailwind with the Ignite UI theme first:
@import "tailwindcss/theme.css";
@import "tailwindcss/utilities.css";
Apply the light-color-picker utility to give the Color Picker its theme variables, then override individual variables with arbitrary-property classes. The ! prefix marks the utility as important so it takes precedence over the component’s default theme styles.
<IgrColorPicker className="!light-color-picker [--ig-color-picker-picker-background:#fff0eb] [--ig-color-picker-picker-border-color:#f95924]"></IgrColorPicker>
Accessibility
The React Color Picker is a keyboard-operable, form-associated control. The anchor is either a labelled button (default mode) or an editable input (input mode), and the open picker traps focus.
Keyboard Interaction
The keybindings below are skipped while the component is disabled.
| Key | Action |
|---|---|
Alt + ArrowDown |
Toggles the picker dropdown. |
Alt + ArrowUp |
Closes the picker dropdown and returns focus to the anchor. |
Escape |
Closes the picker dropdown and returns focus to the anchor. |
Arrow keys |
When the gradient canvas marker is focused, moves the marker by one step in the pressed direction. |
ArrowUp / ArrowDown |
When the alpha input is focused, increases or decreases the opacity by 1%. |
Tab |
Moves focus between the interactive elements inside the open picker. |
Screen Readers / ARIA
- The anchor sets
aria-haspopup="dialog"andaria-expanded, and references the helper-text container viaaria-describedbyso helper and validation messages are announced. - The picker dropdown has
role="dialog"and the accessible nameColor picker. - The gradient canvas marker has
role="slider"and announces both axes througharia-valuetext(for example,Saturation 50%, brightness 80%). - The hue and alpha sliders are native
input[type="range"]elements labelled viaaria-label(Hue,Alpha slider). - The format switcher and the color value input carry visually-hidden labels; the copy and eye-dropper buttons expose visually-hidden text.
- Each swatch button exposes its color through
aria-label. - While the picker is open, focus is trapped within it; the picker content is
inertwhile closed and excluded from the tab order.
Accessibility Compliance
Infragistics documents Ignite UI for React accessibility support for Section 508 and WCAG 2.1 guideline areas in the Accessibility Compliance topic.
| Criterion | How the component complies |
|---|---|
| 1.3.1 Info and Relationships | The component exposes its label, helper text, and validation messages through aria-describedby and slot projection. |
| 2.1.1 Keyboard | Opening and closing the picker, the gradient marker, the sliders, the inputs, the format switcher, and the swatches are keyboard operable. |
| 4.1.2 Name, Role, Value | The anchor exposes aria-haspopup and aria-expanded, the marker exposes role="slider" with its value, the sliders expose accessible labels, and swatches expose their color via aria-label. |
Your responsibilities:
- Provide an accessible label through the
labelproperty or a projected label so the anchor is identifiable to screen readers. - Do not rely on color alone to convey required or invalid state; use the validation slots or helper text.
- Keep sufficient contrast when overriding theme styles for the anchor and picker surface.
Troubleshooting
The React Color Picker troubleshooting guidance follows a problem → cause → fix format for common integration and platform issues.
Why did my color value clear or revert?
Assigning an empty, whitespace-only, or invalid string to value clears the color instead of keeping the previous value. An invalid string typed into the color input reverts to the current color instead. Assign a valid CSS color string, and make sure the environment supports OffscreenCanvas (see Known Limitations).
Why is the emitted value in a different format than what I typed?
The value is always serialized in the active format, so an input string does not round-trip byte-for-byte. For example, typing red with format="hex" produces #ff0000. Set format to the notation you expect to read back.
Why is no igcInput emitted while I type a color?
The color input commits a typed color when it changes, not on every keystroke, and a typed color emits no igcInput. Listen for igcChange, which fires when focus leaves the component with a different color.
Known Limitations
- The eye-dropper button is enabled only in browsers that implement the
EyeDropperAPI. Support is detected once, when the component is created. - Copying to the clipboard depends on
navigator.clipboardand a secure context (HTTPS orlocalhost); it silently does nothing where the API is unavailable or permission is denied. - The component parses every color string through an
OffscreenCanvas2D context. WhereOffscreenCanvasis unavailable, every value resolves to empty. - The built-in accessible labels, such as
Hue,Alpha slider,Open color picker, andCopy color value to clipboard, are English-only and not localized.
API References
Dependencies
The React Color Picker requires a theme stylesheet to apply its visual styling. See the setup in Getting Started.
Additional Resources
Use these resources for support and related Ignite UI documentation.
FAQ
Set the name attribute to the form field name and place the Color Picker inside a <form> element. The current serialized color is submitted under that name, and the control participates in required validation and form reset through the standard form-associated element APIs.
igcInput fires on every interim interaction with the canvas, the sliders, the alpha input, a swatch, or the eye-dropper. igcChange fires once, when focus leaves the Color Picker and the color differs from the one it had when focus entered, matching the semantics of the native change event. A color typed into the color input emits only igcChange.
The Color Picker ships in the igniteui-react package.

