Displays a hex color field input with a swatch.
This component is based on the input
element and supports common margin props m
, mx
, my
, ml
, mr
, mt
, mb
. View source.
When blurred, the Color Field calls onValueChange
, parsing the current value or resetting it to the last seen valid color.
Pressing the Enter key in the Color Field calls onValueChange
, parsing the current value or resetting it to the last seen valid color. Form submission is prevented until the current value matches the last seen valid color.
Pressing the Escape key in the Color Field resets the current value to the last saved color. Components like dialogs won’t close until the current value matches the last seen valid color.