Color Picker

A component that allows users to select a color from a color picker.

Loading...

Anatomy

<ColorPicker.Root>
  <ColorPicker.Label />
  <ColorPicker.Control>
    <ColorPicker.ChannelInput />
    <ColorPicker.Trigger>
      <ColorPicker.ValueSwatch />
    </ColorPicker.Trigger>
  </ColorPicker.Control>
  <ColorPicker.Positioner>
    <ColorPicker.Content>
      <ColorPicker.Area>
        <ColorPicker.AreaBackground />
        <ColorPicker.AreaThumb />
      </ColorPicker.Area>
      <ColorPicker.EyeDropperTrigger />
      <ColorPicker.ChannelSlider>
        <ColorPicker.ChannelSliderTrack />
        <ColorPicker.ChannelSliderThumb />
      </ColorPicker.ChannelSlider>
      <ColorPicker.SwatchGroup>
        <ColorPicker.SwatchTrigger>
          <ColorPicker.Swatch />
        </ColorPicker.SwatchTrigger>
      </ColorPicker.SwatchGroup>
    </ColorPicker.Content>
  </ColorPicker.Positioner>
  <ColorPicker.HiddenInput />
</ColorPicker.Root>

Examples

Controlled

Use value and onValueChange to control the color.

Open Controlled

Use open and onOpenChange to control the popover.

Root Provider

Use RootProvider with the useColorPicker hook to access the state and methods from outside the component.

Disabled

Set disabled to disable the color picker.

Inline

Set inline to render the picker without a popover.

Input Only

An input, value swatch and eye dropper trigger, with no popover content.

Slider Only

Only the RGB channel sliders.

Swatch Only

Only preset swatches.

Swatches

Add preset swatches to the content for quick selection.

Value Swatch

Show the current color as a swatch next to the area and sliders.

Field

Wrap the color picker in Field to wire up the label, helper text and error text accessibly.

Form Usage

Use HiddenInput to connect the color picker to form libraries like React Hook Form.

Inside Dialog

API Reference

Props

Root

Defines the <div> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
closeOnSelectfalse
boolean

Whether to close the color picker when a swatch is selected

defaultFormat'rgba'
ColorFormat

The initial color format when rendered. Use when you don't need to control the color format of the color picker.

defaultOpen
boolean

The initial open state of the color picker when rendered. Use when you don't need to control the open state of the color picker.

defaultValue#000000
Color

The initial color value when rendered. Use when you don't need to control the color value of the color picker.

disabled
boolean

Whether the color picker is disabled

format
ColorFormat

The controlled color format to use

hideMode'display-none'
HideMode

How to hide content when mounted but not present. - `'display-none'`: HTML `hidden` attribute. Effects stay alive. - `'activity'`: React 19 `<Activity mode="hidden">`. Effects pause. Requires React 19+.

id
string

The unique identifier of the machine.

ids
ElementIds

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

immediate
boolean

Whether to synchronize the present change immediately or defer it to the next frame

initialFocusEl
() => false | HTMLElement | null

The initial focus element when the color picker is opened. Return `false` to skip moving focus, or `null` to use the default.

inline
boolean

Whether to render the color picker inline

invalid
boolean

Whether the color picker is invalid

lazyMountfalse
boolean

Whether to enable lazy mounting

locale'en-US'
string

The current locale. Based on the BCP 47 definition.

name
string

The name for the form input

onEnterComplete
VoidFunction

Function called when the animation ends in the open state

onExitComplete
VoidFunction

Function called when the animation ends in the closed state

onFocusOutside
(event: FocusOutsideEvent) => void

Function called when the focus is moved outside the component

onFormatChange
(details: FormatChangeDetails) => void

Function called when the color format changes

onInteractOutside
(event: InteractOutsideEvent) => void

Function called when an interaction happens outside the component

onOpenChange
(details: OpenChangeDetails) => void

Handler that is called when the user opens or closes the color picker.

onPointerDownOutside
(event: PointerDownOutsideEvent) => void

Function called when the pointer is pressed down outside the component

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.

open
boolean

The controlled open state of the color picker

openAutoFocustrue
boolean

Whether to auto focus the color picker when it is opened

positioning
PositioningOptions

The positioning options for the color picker

present
boolean

Whether the node is present (controlled by the user)

readOnly
boolean

Whether the color picker is read-only

render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<ColorPickerRootState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

required
boolean

Whether the color picker is required

skipAnimationOnMountfalse
boolean

Whether to allow the initial presence animation.

unmountOnExitfalse
boolean

Whether to unmount on exit.

value
Color

The controlled color value of the color picker

AttributeDescription
[data-color-picker-root]<uid>
[data-disabled]Present when disabled
[data-readonly]Present when read-only
[data-invalid]Present when invalid
CSS VariableDescription
--valueThe current value

AreaBackground

Defines the <div> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-color-picker-area-background]<uid>
[data-invalid]Present when invalid
[data-disabled]Present when disabled
[data-readonly]Present when read-only

Area

Defines the <div> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

xChannel
ColorChannel

yChannel
ColorChannel

AttributeDescription
[data-color-picker-area]<uid>
[data-invalid]Present when invalid
[data-disabled]Present when disabled
[data-readonly]Present when read-only

AreaThumb

Defines the <div> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-color-picker-area-thumb]<uid>
[data-disabled]Present when disabled
[data-invalid]Present when invalid
[data-readonly]Present when read-only
CSS VariableDescription
--colorThe text color

ChannelInput

Defines the <input> element.

AttributeDefaultType
channel
ExtendedColorChannel

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
orientation
Orientation

render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-color-picker-channel-input]<uid>
[data-channel]The color channel of the channelinput
[data-disabled]Present when disabled
[data-invalid]Present when invalid
[data-readonly]Present when read-only

ChannelSliderLabel

Defines the <label> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-color-picker-channel-slider-label]<uid>
[data-channel]The color channel of the channelsliderlabel

ChannelSlider

Defines the <div> element.

AttributeDefaultType
channel
ColorChannel

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
orientation
Orientation

render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-color-picker-channel-slider]<uid>
[data-channel]The color channel of the channelslider
[data-orientation]The orientation of the channelslider

ChannelSliderThumb

Defines the <div> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-color-picker-channel-slider-thumb]<uid>
[data-channel]The color channel of the channelsliderthumb
[data-disabled]Present when disabled
[data-orientation]The orientation of the channelsliderthumb

ChannelSliderTrack

Defines the <div> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-color-picker-channel-slider-track]<uid>
[data-channel]The color channel of the channelslidertrack
[data-orientation]The orientation of the channelslidertrack

ChannelSliderValueText

Defines the <span> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-color-picker-channel-slider-value-text]<uid>
[data-channel]The color channel of the channelslidervaluetext

Content

Defines the <div> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<ColorPickerContentState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-color-picker-content]<uid>
[data-placement]The placement of the content
[data-side]The side of the trigger that the content is positioned on
[data-state]"open" | "closed"
[data-nested]popover
[data-has-nested]popover
CSS VariableDescription
--layer-indexThe index of the dismissable in the layer stack
--nested-layer-countThe number of nested color-pickers

Control

Defines the <div> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-color-picker-control]<uid>
[data-disabled]Present when disabled
[data-readonly]Present when read-only
[data-invalid]Present when invalid
[data-state]"open" | "closed"
[data-focus]Present when focused

EyeDropperTrigger

Defines the <button> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-color-picker-eye-dropper-trigger]<uid>
[data-disabled]Present when disabled
[data-invalid]Present when invalid
[data-readonly]Present when read-only

FormatSelect

Defines the <select> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

FormatTrigger

Defines the <button> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

HiddenInput

Defines the <input> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

Label

Defines the <label> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-color-picker-label]<uid>
[data-disabled]Present when disabled
[data-readonly]Present when read-only
[data-invalid]Present when invalid
[data-required]Present when required
[data-focus]Present when focused

Positioner

Defines the <div> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-color-picker-positioner]<uid>
[data-nested]Present when the positioner is nested within another {{widget}}
[data-has-nested]Present when the positioner has nested {{widget}}s
CSS VariableDescription
--reference-widthThe width of the reference element
--reference-heightThe height of the root
--available-widthThe available width in viewport
--available-heightThe available height in viewport
--xThe x position for transform
--yThe y position for transform
--transform-originThe transform origin for animations

RootProvider

Defines the <div> element.

AttributeDefaultType
value
UseColorPickerReturn

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
hideMode'display-none'
HideMode

How to hide content when mounted but not present. - `'display-none'`: HTML `hidden` attribute. Effects stay alive. - `'activity'`: React 19 `<Activity mode="hidden">`. Effects pause. Requires React 19+.

immediate
boolean

Whether to synchronize the present change immediately or defer it to the next frame

lazyMountfalse
boolean

Whether to enable lazy mounting

onEnterComplete
VoidFunction

Function called when the animation ends in the open state

onExitComplete
VoidFunction

Function called when the animation ends in the closed state

present
boolean

Whether the node is present (controlled by the user)

render
type ONLY_FOR_FORMAT = ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<ColorPickerRootProviderState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

skipAnimationOnMountfalse
boolean

Whether to allow the initial presence animation.

unmountOnExitfalse
boolean

Whether to unmount on exit.

SwatchGroup

Defines the <div> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

SwatchIndicator

Defines the <div> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

Swatch

Defines the <div> element.

AttributeDefaultType
value
string | Color

The color value

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

respectAlpha
boolean

Whether to include the alpha channel in the color

AttributeDescription
[data-color-picker-swatch]<uid>
[data-state]"checked" | "unchecked"
[data-value]The value of the item
CSS VariableDescription
--colorThe text color

SwatchTrigger

Defines the <button> element.

AttributeDefaultType
value
string | Color

The color value

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
disabled
boolean

Whether the swatch trigger is disabled

render
type ONLY_FOR_FORMAT = ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<ColorPickerSwatchTriggerState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-color-picker-swatch-trigger]<uid>
[data-state]"checked" | "unchecked"
[data-value]The value of the item
[data-disabled]Present when disabled
CSS VariableDescription
--colorThe text color

TransparencyGrid

Defines the <div> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

size
string

CSS VariableDescription
--sizeThe size (width and height) of the element

Trigger

Defines the <button> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<ColorPickerTriggerState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-color-picker-trigger]<uid>
[data-disabled]Present when disabled
[data-readonly]Present when read-only
[data-invalid]Present when invalid
[data-placement]The placement of the trigger
[data-side]The side of the trigger that the trigger is positioned on
[data-state]"open" | "closed"
[data-focus]Present when focused

ValueSwatch

Defines the <div> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

respectAlpha
boolean

Whether to include the alpha channel in the color

ValueText

Defines the <span> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
format
ColorStringFormat

render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-color-picker-value-text]<uid>
[data-disabled]Present when disabled
[data-focus]Present when focused

View

Defines the <div> element.

AttributeDefaultType
format
ColorFormat

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

Context

API

PropertyType
dragging
boolean

Whether the color picker is being dragged

open
boolean

Whether the color picker is open

inline
boolean

Whether the color picker is rendered inline

value
Color

The current color value (as a string)

valueAsString
string

The current color value (as a Color object)

isInSrgbGamut
boolean

Whether the current color lies inside the sRGB gamut (linear RGB cube). When `false`, wide-gamut CSS strings may still be valid while 8-bit RGB / hex are clamped.

setValue
(value: string | Color) => void

Function to set the color value

getChannelValue
(channel: ColorChannel) => string

Function to set the color value

getChannelValueText
(channel: ColorChannel, locale?: string) => string

Function to get the formatted and localized value of a specific channel. Uses the `locale` prop when `locale` is omitted.

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

Function to set the color value of a specific channel

format
ColorFormat

The current color format

setFormat
(format: ColorFormat) => void

Function to set the color format

alpha
number

The alpha value of the color

setAlpha
(value: number) => void

Function to set the color alpha

setOpen
(open: boolean, reason?: OpenChangeReason) => void

Function to open or close the color picker

getRootState
() => RootState

Returns the state of the root

getTriggerState
() => TriggerState

Returns the state of the trigger

getContentState
() => ContentState

Returns the state of the content

getGamutOverlay
(props?: GamutOverlayProps) => GamutOverlayData | null

SVG path + label position for the sRGB gamut boundary (oklch/oklab + HSB area only); `null` when not shown. Use the **same** `props` as

getGamutOverlayProps
(props?: GamutOverlayProps) => T["svg"]

Props for an `<svg>` gamut overlay; pair with

Accessibility

Keyboard Support

KeyDescription
Enter
When focus is on the trigger, opens the color picker
When focus is on a swatch trigger, selects the color (and closes the color picker)
When focus is on a channel input, commits the value
ArrowLeftArrowRight
When focus is on the color area, decreases or increases the x channel
When focus is on a channel slider, decreases or increases the channel
ArrowUpArrowDown
When focus is on the color area, increases or decreases the y channel
When focus is on a channel slider or a number channel input, increases or decreases the channel
PageUpPageDown
When focus is on the color area, increases or decreases the y channel by a larger step
When focus is on a channel slider, increases or decreases the channel by a larger step
HomeEnd
When focus is on the color area, decreases or increases the x channel by a larger step
When focus is on a channel slider, sets the channel to its minimum or maximum
Esc
Closes the color picker and moves focus to the trigger