Components

Color Field

A text input for specifying color values, supporting formats like HEX, RGB, and HSL for precise color selection.

Basic

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

Installation

If you hit any issues, make sure you check out the installation guide here for more information.

Composed Components

When you install this component via the CLI, it automatically loads all composed components, so you don’t need to add them individually.

The Color Field comes packed with several components to enhance functionality and provide a seamless experience.

A versatile UI component that provides multiple ways to choose colors, including sliders, swatches, and manual input.
A predefined color block that allows users to quickly select commonly used or brand-specific colors.
Field's a core piece every other component uses. It flexes reusable styles, showing up in inputs, labels, descriptions, and more.

Manual Installation

Make sure you also install the composed components and the required packages for the component to function properly.

Anatomy

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.

hex#FAFAFAhexa#FAFAFAFFrgbrgb(250, 250, 250)rgbargba(250, 250, 250, 1)hslhsl(0, 0%, 98.04%)hslahsla(0, 0%, 98.04%, 1)hsbhsb(0, 0%, 98.04%)hsbahsba(0, 0%, 98.04%, 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.

Validation

In this example, we’ll ensure it’s treated as a strict requirement.

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)

Get premium Blocks

Create stunning, professional-grade layouts that not only save time but also elevate the quality of your projects.