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
If you hit any issues, make sure you check out the installation guide here.
Composed Components
When you plug this component from the CLI, it autoloads all the composed components. No need to toss 'em in one at a time.
The Color Picker's decked out with several components to make it bangin'.
Button
Buttons be the real MVPs, man! They're all about gettin' stuff done, whether it’s slamming that form submit or hoppin' to another page.Color Field
A color field allows users to adjust a hex color or fine-tune individual color channels, offering precise control over color customization.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.
And next, you can copy the code below and paste it into your dopest component folder.
Enable Format Selection
Enable users to select the format of the color value (e.g., RGB, HSL).
Enable Swatch
Enable a swatch view where users can see and pick from predefined colors.
Custom Colors
Customize the available colors beyond the default Tailwind CSS zinc palette by using the colors
prop.
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.
Description
Include a description to provide additional information or instructions.
Placeholder
Introduce a placeholder in the color picker for an intuitive user interface.
Controlled
Control the selected color with the value
prop to sync it with your application's state.
Disabled
Disable the color picker by setting the isDisabled
prop, making it non-interactive.
Props
Indeed, the ColorPicker
component incorporates all standard props from react-aria-components
along with these specialized props:
Property | Type | Optional |
---|---|---|
space | ColorSpace | Yes |
enableColorSwatch | boolean | Yes |
enableColorFormatSelection | boolean | Yes |
isHex | boolean | Yes |
label | string | Yes |
description | string | Yes |
errorMessage | string | Yes |
placeholder | string | Yes |
colors | string[] | Yes |
isDisabled | boolean | Yes |
className | string | Yes |
trigger | 'color-picker' | 'color-field' | Yes |
enableColorField | boolean | Yes |