Components
Color picker

Color Picker

The Color Picker is a versatile and feature-rich color selection tool for your applications. It provides support for different color spaces, user interaction, and accessibility.

API reference docs for the component. Learn about the props, CSS, and other APIs of this exported module.

ColorPickerProps

defaultValue

string

dir

'ltr' | 'rtl'

The direction of the color picker

disabled

boolean

Whether the color picker is disabled

getRootNode

() => ShadowRoot | Node | Document

A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.

id

string

The unique identifier of the machine.

ids

Partial<{ content: string area: string areaGradient: string areaThumb: string channelInput(id: string): string channelSliderTrack(id: ColorChannel): string channelSliderThumb(id: ColorChannel): string }>

The ids of the elements in the color picker. Useful for composition.

name

string

The name for the form input

onValueChange

(details: ValueChangeDetails) => void

Handler that is called when the value changes, as the user drags.

onValueChangeEnd

(details: ValueChangeDetails) => void

Handler that is called when the user stops dragging.

readOnly

boolean

Whether the color picker is read-only

value

string

The current color value

ColorPickerContext

alpha

number

The alpha value of the color

channels

[ColorChannel, ColorChannel, ColorChannel]

The current color channels of the color

contentProps

Dict<any>

eyeDropperTriggerProps

Dict<any>

getAreaGradientProps

(props: ColorAreaProps) => Dict<any>

getAreaProps

(props: ColorAreaProps) => Dict<any>

getAreaThumbProps

(props: ColorAreaProps) => Dict<any>

getChannelInputProps

(props: ColorChannelInputProps) => Dict<any>

getChannelSliderBackgroundProps

(props: ColorChannelProps) => Dict<any>

getChannelSliderThumbProps

(props: ColorChannelProps) => Dict<any>

getChannelSliderTrackProps

(props: ColorChannelProps) => Dict<any>

getSwatchBackgroundProps

(props: ColorSwatchProps) => Dict<any>

getSwatchProps

(props: ColorSwatchProps) => Dict<any>

hiddenInputProps

Dict<any>

isDragging

boolean

Whether the color picker is being dragged

setAlpha

(value: number) => void

Function to set the color alpha

setChannelValue

(channel: ColorChannel, value: number) => void

Function to set the color value of a specific channel

setColor

(value: string | Color) => void

Function to set the color value

setFormat

(format: ColorFormat) => void

Function to set the color format

value

string

The current color value (as a string)

valueAsColor

Color

The current color value (as a Color object)

ColorPickerAreaProps

xChannel

ColorChannel

yChannel

ColorChannel

ColorPickerAreaContext

xChannel

ColorChannel

yChannel

ColorChannel

ColorPickerSwatchProps

value

string | Color

readOnly

boolean

ColorPickerSwatchContext

value

string | Color

readOnly

boolean

ColorPickerChannelInputProps

channel

ExtendedColorChannel

orientation

Orientation

ColorPickerChannelSliderTrackProps

channel

ColorChannel

orientation

Orientation