Color Picker

A Color Picker keeps color values in sync across React Aria color components. It makes building color pickers with custom layouts a breeze through composition.

Basic

The basic color picker allows users to select a color.

Installation

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

Enable Format Selection

Enable users to select the format of the color value (e.g., RGB, HSL).

Combination

Combine both swatch and selection format options in the color picker.

Label

Add a label to the color picker for better accessibility and user guidance.

Dynamic Label

Dynamically update the label based on the selected color.

import { ColorPicker, defaultColor } from "ui"
 
const [color, setColor] = React.useState(defaultColor)
return <ColorPicker label={color.toString('hex')} value={color} onChange={setColor} />

Description

Include a description to provide additional information or instructions.

Snag a color for the app theme

Controlled

Control the selected color with the value prop to sync it with your application's state.

hsla(216, 98%, 52%, 1)

Disabled

Disable the color picker by setting the isDisabled prop, making it non-interactive.