<ColorEditor defaultValue="#5100FF" />Installation
npx shadcn@latest add @dotui/color-editorUsage
Use a color editor to let users adjust a color with a saturation/brightness area, channel sliders, and format-aware fields. Standalone, it manages its own color value; inside a Color Picker, it edits the picker's color instead.
import { ColorEditor } from '@/ui/color-editor'<ColorEditor defaultValue="#5100FF" />Anatomy
ColorEditor renders a saturation/brightness area with channel sliders, then a row of format-aware fields. Omit children for the default layout, or compose the parts yourself.
import {
ColorEditor,
ColorEditorArea,
ColorEditorFields,
} from '@/ui/color-editor'<ColorEditor>
<ColorEditorArea showAlphaChannel />
<ColorEditorFields defaultFormat="rgb" />
</ColorEditor>ColorEditorArea— the color area, hue slider, and optional alpha slider.ColorEditorFields— channel inputs for the current format, with an optional format selector.
Composition
The default children render an area row and a fields row. Pass your own children to reorder, drop, or extend them — for example, dropping a swatch picker between the two parts.
<ColorEditor defaultValue="#f80">
<ColorEditorArea showAlphaChannel />
<ColorSwatchPicker>{/* ... */}</ColorSwatchPicker>
<ColorEditorFields defaultFormat="rgb" showFormatSelector={false} />
</ColorEditor>Value
The value is a React Aria Color. Use defaultValue for uncontrolled state, or value with onChange to control it. Pass a hex string (including alpha, e.g. #5100FF80) or a Color from parseColor.
<ColorEditor defaultValue="#5100FF" onChange={setColor} />Inside a Color Picker, the editor adopts the
picker's color — value, defaultValue, and onChange are ignored.
Color format
ColorEditorFields picks its channel inputs from the current format. Set the initial format with defaultFormat (hex, rgb, hsl, or hsb), or control it with format and onFormatChange.
<ColorEditorFields format={format} onFormatChange={setFormat} />Examples
Alpha channel
In a color picker
Custom composition
API Reference
ColorEditor
A color editor allows users to adjust a color value using a color area, channel sliders, and field inputs in multiple color formats. Inside a ColorPicker it edits the picker's color; standalone it manages its own.
Supports all div attributes.
| Prop | Type | Default | |
|---|---|---|---|
ColorFormat | 'hex' | ||
boolean | false | ||
boolean | true | ||
Color | string | — | ||
Color | string | '#6366F1' | ||
function | — | ||
ColorEditorArea
A color editor area displays a saturation/brightness area next to a hue slider and an optional alpha slider.
Supports all div attributes.
| Prop | Type | Default | |
|---|---|---|---|
boolean | false | ||
ColorEditorFields
Color editor fields display channel inputs for the current color format, with an optional format selector.
Supports all div attributes.
| Prop | Type | Default | |
|---|---|---|---|
ColorFormat | — | ||
ColorFormat | 'hex' | ||
boolean | true | ||
Last updated on 7/22/2026