Skip to content

ColorPicker

ColorPicker ​

Widget for selecting the color.

jsx
import ColorPicker from '@semcore/ui/color-picker';
<ColorPicker />;

NSColorPicker.Props ​

& {...}
NameTypeDescription
valuestring | null Selected color item. Should be used with `onChange` property together
onChange(value: string, event: ) => void Fired when user selects color item. Should be used with `value` property together
defaultValuestring | null Default value if `value` property is not provided
colors(string | null)[] Array of color items. Should be used with `onColorsChange` property together
onColorsChange(value: string[], event: ) => void Fired when user changes color items. Should be used with `colors` property together
displayLabelboolean Shows label `A` as text color icon inside all color items

ColorPicker.Trigger ​

The wrap over the <Dropdown.Trigger/> component.

jsx
import ColorPicker from '@semcore/ui/color-picker';
<ColorPicker.Trigger />;

ColorPicker.Popper ​

The wrap over the <Dropdown.Popper/> component.

jsx
import ColorPicker from '@semcore/ui/color-picker';
<ColorPicker.Popper />;

ColorPicker.Colors ​

List of colors in ColorPicker.

jsx
import ColorPicker from '@semcore/ui/color-picker';
<ColorPicker.Colors />;

NSColorPicker.Colors.Props ​

& {...}
NameTypeDescription
colorsArray<string | null> Array of color items

ColorPicker.Item ​

WARNING

ColorPicker.Item is deprecated. Use ColorPicker.Colors.

One unit of <ColorPicker.Colors />. ColorPicker.Item is a swatch preview that allows a user to see what color is currently selected.

jsx
import ColorPicker from '@semcore/ui/color-picker';
<ColorPicker.Item />;

ItemProps ​

& {...}
NameTypeDescription
valuestring | null Color item in hexadecimal format.
displayLabelboolean Shows label `A` as text color icon inside all color items
editableboolean Property enabling the ability to remove a color item on click
selectedboolean Shows if color item is selected
onRemove Fired with color item when user clicks on the close icon

PaletteManager ​

Part of ColorPicker that provides the ability to add and remove custom colors to the palette.

jsx
import { PaletteManager } from '@semcore/ui/color-picker';
<PaletteManager />;

NSPaletteManager.Props ​

NameTypeDescription
colorsstring[] Array of color items. Should be used with `onColorsChange` property together
defaultColorsstring[] Default value if `colors` property is not provided
onColorsChange(value: string[], event: ) => void Fired when user adds or removes color items. Should be used with `colors` property together

PaletteManager.Colors ​

List of colors in PaletteManager.

jsx
import { PaletteManager } from '@semcore/ui/color-picker';
<PaletteManager.Colors />;

NSPaletteManager.Colors.Props ​

& {...}
NameTypeDescription
onPlusButtonClick Fired when user clicks on the plus icon in Palette Manager - focuses the input component

PaletteManager.Item ​

WARNING

PaletteManager.Item is deprecated. Use PaletteManager.Colors.

One unit of <PaletteManager.Colors />. PaletteManager.Item is a swatch preview that allows a user to see what color is currently selected.

jsx
import { PaletteManager } from '@semcore/ui/color-picker';
<PaletteManager.Item />;

ItemProps ​

& {...}
NameTypeDescription
valuestring | null Color item in hexadecimal format.
displayLabelboolean Shows label `A` as text color icon inside all color items
editableboolean Property enabling the ability to remove a color item on click
selectedboolean Shows if color item is selected
onRemove Fired with color item when user clicks on the close icon

ColorPicker.InputColor ​

Input for adding colors in hexadecimal format.

jsx
import { PaletteManager } from '@semcore/ui/color-picker';
<PaletteManager.InputColor />;

NSPaletteManager.InputColor.Props ​

& {...}
NameTypeDescription
valuestring Text value of input
defaultValuestring | null Default value if `value` property is not provided
state"normal" | "valid" | "invalid" Uncontrolled visual state of input
colorsstring[] Array of color items
onAdd(value: string, event: | ) => void Fired with entered value when user clicks on the check icon or hits `Enter` or `Space`
onStateChange(state: "normal" | "valid" | "invalid") => void Handle changes of state

Released under the MIT License.

Released under the MIT License.