Getting Started
Dark Mode
Charts
Colors
Drag-and-drop
Forms
Utilities
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
If you hit any issues, make sure you check out the installation guide here for more information.
Composed Components
Plug this component into the CLI, and it automatically loads all the included components. No need to add them individually.
The Color Field comes packed with a variety of components to make it stand out.
Manual Installation
Sometimes, using the CLI is the way to go, so make sure you install the necessary dependencies for the components you want to use.
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.
You can typically click the color swatch to open the color picker. To disable this feature, set enableColorPicker
to 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:
Property | Type | Optional |
---|---|---|
label | string | Yes |
description | string | Yes |
errorMessage | string | ((validation: ValidationResult) => string) | Yes |
placeholder | string | Yes |
prefix | React.ReactNode | Yes |
suffix | React.ReactNode | Yes |
isLoading | boolean | Yes |
enableColorPicker | boolean | Yes ( default: true) |