Color Field

A color field allows users to adjust a hex color or fine-tune individual color channels, offering precise control over color customization.

Basic

A color field allows users to adjust a hex color or manipulate individual color channels.

Installation

In the terminal, run the following command to begin:
npx hq-kit add color-field

Prefix

A color field can include a prefix to provide context or functionality.

Suffix

A color field can also have a suffix.

Controlled

Manage the color field in a controlled manner to automatically update the ColorSwatch and display the current color.

rgba(250, 250, 250, 1)

You can typically click the color swatch to open the color picker. To disable this feature, set enableColorPicker to false.

<ColorField enableColorPicker={false} />

Disabled

You can disable the color field, making it non-interactive.

Props

The ColorField component includes all standard props from react-aria-components, plus these additional features:

PropertyTypeOptional
labelstringYes
descriptionstringYes
errorMessagestring | ((validation: ValidationResult) => string)Yes
placeholderstringYes
prefixReact.ReactNodeYes
suffixReact.ReactNodeYes
isLoadingbooleanYes
enableColorPickerbooleanYes ( default: true)