booleanWhether to close the color picker when a swatch is selected
defaultFormat
"rgba"
ColorFormatThe initial color format when rendered.
Use when you don't need to control the color format of the color picker.
defaultOpen
booleanThe 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
ColorThe initial color value when rendered.
Use when you don't need to control the color value of the color picker.
disabled
booleanWhether the color picker is disabled
format
ColorFormatThe controlled color format to use
id
stringThe unique identifier of the machine.
ids
{
root?: string;
control?: string;
trigger?: string;
label?: string;
input?: string;
hiddenInput?: string;
content?: string;
area?: string;
areaGradient?: string;
positioner?: string;
formatSelect?: string;
areaThumb?: string;
channelInput(id: string)?: string;
channelSliderTrack(id: ColorChannel)?: string;
}The ids of the elements in the color picker. Useful for composition.
initialFocusEl
() => HTMLElementThe initial focus element when the color picker is opened.
invalid
booleanWhether the color picker is invalid
keepMounted
booleanWhether to keep the component mounted after exit.
lazyMount
booleanWhether to enable lazy mounting.
name
stringThe name for the form input
onFocusOutside
(event: FocusOutsideEvent) => voidFunction called when the focus is moved outside the component
onFormatChange
(details: FormatChangeDetails) => voidFunction called when the color format changes
onInteractOutside
(event: InteractOutsideEvent) => voidFunction called when an interaction happens outside the component
onOpenChange
(details: OpenChangeDetails) => voidHandler that is called when the user opens or closes the color picker.
onPointerDownOutside
(event: PointerDownOutsideEvent) => voidFunction called when the pointer is pressed down outside the component
onValueChange
(details: ValueChangeDetails) => voidHandler that is called when the value changes, as the user drags.
onValueChangeEnd
(details: ValueChangeDetails) => voidHandler that is called when the user stops dragging.
open
booleanThe controlled open state of the color picker
openAutoFocus
true
booleanWhether to auto focus the color picker when it is opened
positioning
PositioningOptionsThe positioning options for the color picker
readOnly
booleanWhether the color picker is read-only
required
booleanWhether the color picker is required
value
ColorThe controlled color value of the color picker
asChild
SnippetRender a different element.
Data Attribute
Value
data-disabled
Present when disabled
data-invalid
Present when invalid
data-part
root
data-readonly
Present when read-only
data-scope
color-picker
Area
Prop
Default
Description
asChild
SnippetRender a different element.
Data Attribute
Value
data-disabled
Present when disabled
data-invalid
Present when invalid
data-part
area
data-readonly
Present when read-only
data-scope
color-picker
AreaBackground
Prop
Default
Description
asChild
SnippetRender a different element.
Data Attribute
Value
data-disabled
Present when disabled
data-invalid
Present when invalid
data-part
area-background
data-readonly
Present when read-only
data-scope
color-picker
AreaThumb
Prop
Default
Description
asChild
SnippetRender a different element.
Data Attribute
Value
data-disabled
Present when disabled
data-invalid
Present when invalid
data-part
area-thumb
data-readonly
Present when read-only
data-scope
color-picker
ChannelInput
Prop
Default
Description
channel
ExtendedColorChannel
orientation
Orientation
asChild
SnippetRender a different element.
Data Attribute
Value
data-channel
The color channel of the channelinput
data-disabled
Present when disabled
data-invalid
Present when invalid
data-part
channel-input
data-readonly
Present when read-only
data-scope
color-picker
ChannelSlider
Prop
Default
Description
channel
ColorChannel
orientation
Orientation
asChild
SnippetRender a different element.
Data Attribute
Value
data-channel
The color channel of the channelslider
data-orientation
The orientation of the channelslider
data-part
channel-slider
data-scope
color-picker
ChannelSliderLabel
Prop
Default
Description
asChild
SnippetRender a different element.
Data Attribute
Value
data-channel
The color channel of the channelsliderlabel
data-part
channel-slider-label
data-scope
color-picker
ChannelSliderThumb
Prop
Default
Description
asChild
SnippetRender a different element.
Data Attribute
Value
data-channel
The color channel of the channelsliderthumb
data-disabled
Present when disabled
data-orientation
The orientation of the channelsliderthumb
data-part
channel-slider-thumb
data-scope
color-picker
ChannelSliderTrack
Prop
Default
Description
asChild
SnippetRender a different element.
Data Attribute
Value
data-channel
The color channel of the channelslidertrack
data-orientation
The orientation of the channelslidertrack
data-part
channel-slider-track
data-scope
color-picker
ChannelSliderValueText
Prop
Default
Description
asChild
SnippetRender a different element.
Data Attribute
Value
data-channel
The color channel of the channelslidervaluetext
data-part
channel-slider-value-text
data-scope
color-picker
Content
Prop
Default
Description
asChild
SnippetRender a different element.
Data Attribute
Value
data-part
content
data-placement
The placement of the content
data-scope
color-picker
data-state
"open" | "closed"
Control
Prop
Default
Description
asChild
SnippetRender a different element.
Data Attribute
Value
data-disabled
Present when disabled
data-focus
Present when focused
data-invalid
Present when invalid
data-part
control
data-readonly
Present when read-only
data-scope
color-picker
data-state
"open" | "closed"
EyeDropperTrigger
Prop
Default
Description
asChild
SnippetRender a different element.
Data Attribute
Value
data-disabled
Present when disabled
data-invalid
Present when invalid
data-part
eye-dropper-trigger
data-readonly
Present when read-only
data-scope
color-picker
FormatSelect
Prop
Default
Description
asChild
SnippetRender a different element.
FormatTrigger
Prop
Default
Description
asChild
SnippetRender a different element.
HiddenInput
Prop
Default
Description
asChild
SnippetRender a different element.
Label
Prop
Default
Description
asChild
SnippetRender a different element.
Data Attribute
Value
data-disabled
Present when disabled
data-focus
Present when focused
data-invalid
Present when invalid
data-part
label
data-readonly
Present when read-only
data-scope
color-picker
Positioner
Prop
Default
Description
asChild
SnippetRender a different element.
Swatch
Prop
Default
Description
respectAlpha
booleanWhether to respect the alpha channel of the color.
value
string | ColorThe color value of the swatch.
asChild
SnippetRender a different element.
Data Attribute
Value
data-part
swatch
data-scope
color-picker
data-state
"checked" | "unchecked"
data-value
The value of the item
SwatchGroup
Prop
Default
Description
asChild
SnippetRender a different element.
SwatchIndicator
Prop
Default
Description
asChild
SnippetRender a different element.
SwatchTrigger
Prop
Default
Description
disabled
booleanWhether the swatch is disabled.
value
string | ColorThe color value of the swatch.
asChild
SnippetRender a different element.
Data Attribute
Value
data-disabled
Present when disabled
data-part
swatch-trigger
data-scope
color-picker
data-state
"checked" | "unchecked"
data-value
The value of the item
TransparencyGrid
Prop
Default
Description
size
string
asChild
SnippetRender a different element.
Trigger
Prop
Default
Description
asChild
SnippetRender a different element.
Data Attribute
Value
data-disabled
Present when disabled
data-focus
Present when focused
data-invalid
Present when invalid
data-part
trigger
data-placement
The placement of the trigger
data-readonly
Present when read-only
data-scope
color-picker
data-state
"open" | "closed"
ValueSwatch
Prop
Default
Description
respectAlpha
boolean
asChild
SnippetRender a different element.
Data Attribute
Value
data-part
swatch
data-scope
color-picker
data-state
"checked" | "unchecked"
data-value
The value of the item
ValueText
Prop
Default
Description
asChild
SnippetRender a different element.
Data Attribute
Value
data-disabled
Present when disabled
data-focus
Present when focused
data-part
value-text
data-scope
color-picker
View
Prop
Default
Description
asChild
SnippetRender a different element.
Accessibility
Keyboard Support
Key
Description
Enter
When focus is on the trigger, opens the color picker When focus is on a trigger of a swatch, selects the color (and closes the color picker) When focus is on the input or channel inputs, selects the color
ArrowLeft
When focus is on the color area, decreases the hue value of the color When focus is on the channel sliders, decreases the value of the channel
ArrowRight
When focus is on the color area, increases the hue value of the color When focus is on the channel sliders, increases the value of the channel
ArrowUp
When focus is on the color area, increases the saturation value of the color When focus is on the channel sliders, increases the value of the channel
ArrowDown
When focus is on the color area, decreases the saturation value of the color When focus is on the channel sliders, decreases the value of the channel
Esc
Closes the color picker and moves focus to the trigger