Skip to content

ColorPicker

Description ​

ColorPicker is a component that allows the user selecting a color from a predefined list or input a custom color using its HEX code.

Component composition ​

ColorPicker consists of the following:

  • ColorPicker.Trigger
  • ColorPicker.Popper
  • ColorPicker.Colors: list of predefined colors
  • PaletteManager (optional): container for user's custom colors, which includes:
    • PaletteManager.Colors: list of added colors
    • PaletteManager.InputColor: set of controls for adding new colors

Appearance ​

Trigger ​

ColorPicker's trigger is a Dropdown.Trigger with a circle showing the current selected color.

List of colors ​

The list of colors consists of preview swatches that display all available color values.

Color swatch types ​

Color swatches can have one of the two types of appearance:

Color types
TypeAppearance exampleUsage
FillUse for setting colors for markers, lines, and other non-text elements. For example, a user can pick colors to visually separate their competitors.
Text colorUse for changing the Tag color, for example

Height ​

The height of the dropdown depends on its content.

Showing all available colors in the dropdown is crucial. However, if there's more than 5 rows of colors, you should limit the height and display a scrollbar.

DropdownMenu appearance
Default dropdownDropdown with more than 5 rows of colors

Interaction ​

Background color ​

Background color item states
Item typeNormalHoverActive
Predefined fill
Custom fill
No fill

Text color ​

Text color item states
Item typeNormalHoverActive
Predefined text color
Custom text color
No text color

Adding colors ​

States of item for adding colors
Item typeNormalHoverActive
Add color button

Custom colors (optional) ​

Users have the ability to add or remove custom colors, but they can't modify predefined colors.

TIP

We recommend that your product sync and save the user's custom palette in different parts of the interface.

Adding custom color ​

Users can add a color to the custom palette by entering the value into the input field and saving it by pressing Enter or clicking the Check button.

The input field only allows six characters, including numbers and letters from A to F. If the user enters fewer or more characters, or characters that can't be converted to a 6-character HEX value, the input gets the invalid state.

To help users fix the invalid input, add the following message to the tooltip: "Please enter 6 latin letters and/or digits."

TIP

User can enter both upper-case and lower-case characters, but the input will save them as upper-case.

Removing custom color ​

Usage in UX/UI ​

Components that you can use as a trigger for the ColorPicker:

Released under the MIT License.

Released under the MIT License.