<ColorArea aria-label="Color" defaultValue="#ff0000">
<ColorThumb />
</ColorArea>Installation
npx shadcn@latest add @dotui/color-areaUsage
Use color areas to allow users to select a color from a two-dimensional gradient.
import { ColorArea } from '@/components/ui/color-area'
import { ColorThumb } from '@/components/ui/color-thumb'<ColorArea>
<ColorThumb />
</ColorArea>Anatomy
A ColorArea renders the gradient and positions a ColorThumb. If you omit children, a default ColorThumb is rendered for you.
import { ColorArea } from '@/components/ui/color-area'
import { ColorThumb } from '@/components/ui/color-thumb'
;<ColorArea>
<ColorThumb />
</ColorArea>Value
Use defaultValue for uncontrolled state, or value with onChange to control it. Uncontrolled values accept a color string; controlled values are Color objects created with parseColor.
import { parseColor } from 'react-aria-components'
const [value, setValue] = React.useState(parseColor('hsl(0, 100%, 50%)'))
<ColorArea value={value} onChange={setValue} />Channels
xChannel and yChannel map two channels of the color to the horizontal and vertical axes of the gradient.
<ColorArea xChannel="saturation" yChannel="lightness" />Examples
Default
Brand Color Picker
Theme Customizer
API Reference
ColorArea
A color area allows users to adjust two channels of an RGB, HSL or HSB color value against a two-dimensional gradient background.
| Prop | Type | Default | |
|---|---|---|---|
ReactNode | function | — | ||
ColorSpace | — | ||
boolean | — | ||
ColorChannel | — | ||
string | — | ||
ColorChannel | — | ||
string | — | ||
Color | string | — | ||
Color | string | — | ||
function | — | ||
function | — | ||
ColorThumb
A color thumb appears within a ColorArea, ColorSlider, or ColorWheel and allows a user to drag to adjust the color value.
| Prop | Type | Default | |
|---|---|---|---|
ReactNode | function | — | ||
Last updated on 7/7/2026