Components/Form
Interactive docs page: https://wix-pages.com/design-system-documentation/#/component/colorinput
Color input allows the user to select a color, either by using a visual color picker or by entering the HEX color code manually into the text field.
<Swatches/> instead.Adjust the component's size using the size prop. It supports 3 sizes:
large to emphasize the input field.medium for all common cases (default).small when the layout is dense and narrow.Indicate the component's status using the status prop. It has three states:
error state to indicate an invalid value (e.g., a HEX value that doesn't exist).warning state to highlight a value that can cause an unwanted result (e.g., text color is the same as the background color).loading state to show the value is currently being saved or validated.Add text that explains the status or what action the user should take with the statusMessage prop.
Showing the status message inline, directly below the input is preferred in all default cases.
<FormField/> and add the statusMessage.statusMessage prop. Control tooltip placement with tooltipPlacement prop.View more inline status message examples in <FormField/>.
Prevent the user from using the color input field with the disabled prop. Use it to indicate that the field is unavailable for editing (e.g., if the element already has a pre-defined color that can't be changed).
Adjust the placement and behavior of the color picker popover by using any of the properties in popoverProps. Check the <Popover/> component API for a full list.
Allow users to add new color presets inside the color picker by clicking an "Add color" button. Use a combination of the colorPickerChildren and the onAddColor properties to add this ability.
Use color input in a variety of composers to define custom colors for text, background fills, icons, etc.
| Name | Type | Default | Description |
|---|---|---|---|
addTooltipContent | ReactNode | — | Defines content to show in add button tooltip. Doesn't appear if onAdd isn't passed. |
ariaControls | string | — | Associate a control with the regions that it controls. |
ariaDescribedby | string | — | Associate a region with its descriptions. Similar to aria-controls but instead associating descriptions to the region and description identifiers are separated with a space. |
ariaLabel | string | — | Define a string that labels the current element in case where a text label isn't visible on the screen. |
ariaRoledescription | string | — | Sets the aria-roledescription attribute of the <input> element, giving assistive technologies a readable description of its role. |
autocomplete | string | — | Sets the value of the native autocomplete attribute, for example off or email. |
autoFocus | boolean | — | Focus the element on mount (standard React input autoFocus) |
autoSelect | boolean | — | Automatically selects the entire input text. |
backgroundColor | string | — | Sets the background color of the input. Accepts any CSS color value. |
border | "none" | "standard" | "round" | "bottomLine" | — | Control the border style of input. |
children | ReactNode | — | |
clearButton | boolean | — | Displays clear button (X) on a non-empty input. |
clearButtonAriaLabel | string | — | Aria label for the clear button. |
clearButtonTooltipContent | ReactNode | — | When provided, hovering displays a tooltip with this content. |
clearButtonTooltipProps | TooltipCommonProps | — | Clear button tooltip props. |
colorPickerChildren | ReactNode | ColorPickerChildrenRenderer | — | Defines child items to render inside of a component. Accepts any kind of content, or a function that receives { changeColor } to control the <ColorInput/> value and returns the content. |
customInput | ReactNode | Function | — | Render a custom input instead of the default html input tag. |
dataHook | string | — | Applies a data-hook HTML attribute that can be used in the tests. |
defaultValue | string | number | — | Defines the initial value of an input. |
disabled | boolean | — | Specifies whether input should be disabled or not. |
disableEditing | boolean | — | Restricts input editing. |
enterKeyHint | "search" | "enter" | "done" | "go" | "next" | "previous" | "send" | — | Sets the label of the virtual keyboard's enter key on touch devices. |
focusOnClearClick | boolean | — | Specifies whether to focus the field when clear button is clicked. |
hideStatusSuffix | boolean | — | Specifies whether status suffix should be hidden. |
id | string | — | Assigns a unique identifier for the root element. |
inputmode | string | — | Sets the value of the native inputmode attribute, which tells mobile browsers which on-screen keyboard to show, for example numeric or email. |
inputRef | null | (instance: HTMLInputElement | null) => void | RefObject<HTMLInputElement> | — | Ref to the underlying <input> DOM element. Accepts callback and object refs. Use for input masking libraries such as use-mask-input. Memoize callback refs to avoid reattaching on every render. |
max | number | — | Sets a maximum value of an input. Similar to html5 max attribute. |
maxLength | number | — | Sets the maximum number of characters that can be inserted to a field. |
menuArrow | boolean | — | Specifies whether input should have a dropdown menu arrow on the right side. |
min | number | — | Sets a minimum value of an input. Similar to HTML5 min attribute. |
name | string | — | Reference element data when a form is submitted. |
noLeftBorderRadius | boolean | — | Specifies whether input shouldn't have rounded corners on its left. |
noRightBorderRadius | boolean | — | Specifies whether input shouldn't have rounded corners on its right. |
onAddColor | (color: string) => void | — | Defines a callback handler with color HEX string. Handler is called whenever the Add Color button is pressed. |
onBlur | FocusEventHandler | — | Defines a standard input onBlur callback. |
onCancel | (color: string | object) => void | — | Returns last confirmed value from value prop. |
onChange | (color: string | object) => void | — | Returns changed value of input or color picker. |
onClear | (event: KeyboardEvent<HTMLButtonElement> | MouseEvent<HTMLButtonElement, MouseEvent>) => void | — | Displays clear button (X) on a non-empty input and calls a callback function. |
onCompositionChange | (isComposing: boolean) => void | — | Defines a callback function called on compositionstart/compositionend events. |
onConfirm | (color: string | object) => void | — | Returns confirmed value. |
onCopy | ClipboardEventHandler<HTMLInputElement> | — | Defines a callback handler that is called when user copies text to a clipboard (using a mouse or keyboard shortcut) |
onEnterPressed | KeyboardEventHandler<HTMLInputElement> | — | Defines a callback handler that is called when the user presses -enter-. |
onEscapePressed | KeyboardEventHandler<HTMLInputElement> | — | Defines a callback handler that is called when the user presses -escape-. |
onFocus | FocusEventHandler | — | Defines a standard input onFocus callback. |
onInputClicked | MouseEventHandler | — | Defines a standard input onClick callback. |
onKeyDown | KeyboardEventHandler<HTMLInputElement> | — | Defines a standard input onKeyDown callback. |
onKeyUp | KeyboardEventHandler<HTMLInputElement> | — | Defines a standard input onKeyUp callback. |
onPaste | ClipboardEventHandler<HTMLInputElement> | — | Defines a callback handler that is called when user pastes text from a clipboard (using a mouse or keyboard shortcut) |
pattern | string | — | Sets a pattern that typed value must match to be valid (regex) |
placeholder | string | '' | Sets a placeholder message to display. |
popoverAppendTo | "window" | "scrollParent" | "viewport" | "parent" | — | Sets the element the color-picker popover is rendered into. |
popoverPlacement | "right" | "left" | "top" | "bottom" | "auto" | "auto-start" | "auto-end" | "top-start" | "top-end" | "right-start" | "right-end" | "bottom-end" | "bottom-start" | "left-end" | "left-start" | — | Controls where the color-picker popover opens relative to the input. |
popoverProps | Omit<PopoverNextProps, "children" | "dataHook" | "onClickOutside" | "placement" | "appendTo" | "fixed" | "showArrow" | "shown" | "open" | "onOpenChange"> | — | Accepts popover props that are passed to the color picker popover. |
prefix | ReactNode | — | Pass a component you want to show as the prefix of the input, e.g., text, icon. |
readOnly | boolean | — | Specifies whether input is read only. |
ref | null | string | (instance: ColorInputComponent | null) => void | RefObject<ColorInputComponent> | — | Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref). |
required | boolean | — | Specifies whether input is mandatory. |
role | string | — | Specifies the role of the input element for accessibility. |
rtl | boolean | — | Specifies text direction. If true, the text is displayed from right to left. |
showDrawerOnMobile | boolean | true | Specifies whether the color picker opens in a bottom <Drawer/> when WixDesignSystemProvider has mobile enabled. |
size | "small" | "medium" | "large" | 'medium' | Controls the size of the input. Default value: medium |
status | "error" | "warning" | "loading" | — | Specify the status of a field. |
statusMessage | ReactNode | — | Defines the message to display on status icon hover. If not given or empty, no tooltip is displayed. |
statusMessageTooltipProps | TooltipCommonProps | — | Status message tooltip props. |
step | number | — | Specifies the interval between number values. |
suffix | ReactNode | — | Pass a component you want to show as the suffix of the input, e.g., text, icon. |
tabIndex | number | — | Indicates that element can be focused and where it participates in sequential keyboard navigation. |
textOverflow | "ellipsis" | "clip" | — | Handles text overflow behavior. It can either clip (default) or display ellipsis. |
tooltipPlacement | "right" | "left" | "top" | "bottom" | "auto" | "auto-start" | "auto-end" | "top-start" | "top-end" | "right-start" | "right-end" | "bottom-end" | "bottom-start" | "left-end" | "left-start" | — | Controls placement of a status tooltip. |
type | string | — | Specifies the type of <input/> element to display. Default is text. |
value | string | '' | Specifies the current value of the element. |
withSelection | boolean | — |
Import the driver matching your test environment:
| Method | Description |
|---|---|
cancel | Cancels color selection |
confirm | Confirms color selection |
clickColorViewer | Clicks on color viewer box |
enterText | Enters text to color input |
getValue | Gets the input value |
getPlaceholder | Gets the placeholder of the input |
getSize | Gets the input size |
isDisabled | Checks whether the input is disabled |
colorPickerVisible | Checks whether the color picker is visible |
click | Clicks on input |
hasStatus | Checks whether the given status is displayed |
getStatusMessage | Gets the status message |
exists | Checks whether the component found with the given data hook. |
element | Gets the component root element. |
base | Returns UniDriver for the base element. |
Last updated: 30 October 2026