Color Picker provides a workflow to change color, modify transparency, and save favorite colors.

Overview

Color Picker sliders can be used for general hue shifts, while hexadecimal (Hex) and other channels such as RGB can be used for more exact color choices. The ability to save colors helps keep the user experience more efficient.

Channels and features can be hidden with properties to keep the workflow focused.

Sample

Usage

  • Choosing an initial color of an element
  • Changing color or transparency of an element
  • Ability to copy/paste Hex, RGB, HSV, or other values

Keyboard navigation

KeyFunction
Arrow downWhen focused on the Hex, RGB, or HSV inputs decreases the value by one (1).
Arrow upWhen focused on the Hex, RGB, or HSV inputs increases the value by one (1).
Shift and Arrow downWhen focused on the Hex, RGB, or HSV inputs decreases the value by ten (10).
Shift and Arrow upWhen focused on the Hex, RGB, or HSV inputs increases the value by ten (10).
TabMoves focus to the next focusable element. If the currently focused element is the last element, focus will leave the component.
Tab and ShiftMoves focus to the previous focusable element. If the currently focused element is the first element, focus will leave the component.

API reference

Properties

PropertyAttributeDescriptionTypeDefault
alphaChannelalpha-channel

When true, the component will allow updates to the color's alpha value.

booleanfalse
channelsDisabledchannels-disabled

When true, hides the RGB/HSV channel inputs.

booleanfalse
clearableclearable

When true, an empty color (null) will be allowed as a value.

When false, a color value is enforced, and clearing the input or blurring will restore the last valid value.

booleanfalse
disableddisabled

When true, interaction is prevented and the component is displayed with lower opacity.

booleanfalse
fieldDisabledfield-disabled

When true, hides the color field.

booleanfalse
formatformat

The format of value.

When "auto", the format will be inferred from value when set.

Format"auto"
hexDisabledhex-disabled

When true, hides the hex input.

booleanfalse
messageOverrides

Overrides individual strings used by the component.

Record<string, unknown> | undefined
numberingSystemnumbering-system

Specifies the Unicode numeral system used by the component for localization.

NumberingSystem
savedDisabledsaved-disabled

When true, hides the saved colors section.

booleanfalse
scalescale

Specifies the size of the component.

Scale"m"
storageIdstorage-id

Specifies the storage ID for colors.

string
valuevalue

The component's value, where the value can be a CSS color string, or a RGB, HSL or HSV object.

The type will be preserved as the color is updated.

ColorValue | null

Styles

NameDescription
--calcite-color-picker-background-color

Specifies the component's background color.

--calcite-color-picker-border-color

Specifies the component's border color.

--calcite-color-picker-corner-radius

Specifies the component's corner radius.

--calcite-color-picker-shadow

Specifies the component's shadow.

--calcite-color-picker-text-color

Specifies the component's text color.

--calcite-color-picker-input-background-color

Specifies the component's input background color.

--calcite-color-picker-input-border-color

Specifies the component's input border color.

--calcite-color-picker-input-text-color

Specifies the component's input text color.

--calcite-color-picker-input-prefix-text-color

When hexDisabled is not true, specifies the component's input prefix text color.

--calcite-color-picker-input-suffix-text-color

When alphaChannel is true, specifies the component's input suffix text color.

--calcite-color-picker-tab-border-color

Specifies the component's tab border color.

--calcite-color-picker-tab-text-color

Specifies the component's tab text color.

--calcite-color-picker-tab-accent-color-press

Specifies the component's tab accent color when selected or active.

--calcite-color-picker-swatch-corner-radius

Specifies the component's swatch corner radius.

--calcite-color-picker-action-text-color-press

Specifies the component's savedColors action text color when pressed.

--calcite-color-picker-action-text-color-hover

Specifies the component's savedColors action text color when hovered.

--calcite-color-picker-action-text-color

Specifies the component's savedColors action text color.

Events

NameDescriptionBehavior
calciteColorPickerChange

Fires when the color value has changed.

bubblescomposed
calciteColorPickerInput

Fires as the color value changes.

Similar to the calciteColorPickerChange event with the exception of dragging. When dragging the color field or hue slider thumb, this event fires as the thumb is moved.

bubblescomposed

Methods

NameDescriptionSignature
componentOnReady

Creates a promise that resolves once the component is fully loaded.

componentOnReady(): Promise<this>
setFocus

Sets focus on the component's first focusable element.

setFocus(options?: FocusOptions): Promise<void>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.