Color Area
Overview
A two-dimensional color editor for saturation/lightness, saturation/brightness, or OKLCH chroma/lightness selection. SColorArea combines the Aria ColorAreaRoot/ColorAreaArea/ColorAreaThumb primitives with the colorAreaVariants style recipe (3 slots, 6 sizes).
Use a color area for a saturation/lightness plane inside a color picker (typically paired with color-slider for the hue channel).
Usage
Features
- 🧩 Aria/styled split —
ColorAreaCompactcomposes the area + thumb;SColorAreaonly injects styles and forwards props/events - 🎛️ Axis channels —
xChannel/yChannelpickhue/saturation/lightness/brightness/chroma - 🎨 Color spaces —
colorSpace(e.g.hsl,oklch) withformatfor the emitted string - ⌨️ Keyboard — arrow keys adjust the thumb in fine/step increments;
role="application"+role="slider" - 📝 Form fields — hidden
x/yinputs viaxName/yNamefor native form submission - 🔒 Disabled —
disableddisables interaction - 📐 6 sizes — xs–2xl
size; per-slotuioverrides
Component family
SColorArea(styled) — the entry wrapper;colorAreaVariantsrecipe with dynamic slot forwardingColorAreaRoot(Aria) — the state owner;modelValue/color, axis channels,colorSpace/format,updateValues/commitValuesColorAreaArea(Aria) — the 2D plane surfaceColorAreaThumb(Aria) — the draggable position indicatorColorAreaCompact(Aria) — the aggregated composite; composes area + thumb
Demo
Basic
OKLCH
API
Aria Layer
5ColorArea
Props
| Prop | Type | Default | Description |
|---|---|---|---|
class | ClassValue | — | Additional class names applied to the root element. |
size | ThemeSize | — | Visual size of the component. |
ui | Partial<ColorAreaUi> | — | Per-slot class overrides for the component. |
areaProps | ColorAreaAreaProps | — | Properties forwarded to the area element. |
thumbProps | ColorAreaThumbProps | — | Properties forwarded to the thumb element. |
modelValue | import("@soybeanjs/colord").AnyColor | — | Current model value. |
defaultValue | import("@soybeanjs/colord").AnyColor | — | Default value. |
colorSpace | ColorSpace | — | Color space. |
format | ColorFormat | — | Format. |
xChannel | ColorAreaAxisChannel | — | X channel. |
yChannel | ColorAreaAxisChannel | — | Y channel. |
disabled | boolean | — | Whether the component is disabled. |
xName | string | — | X name. |
yName | string | — | Y name. |
name | string | — | The name of the field. Submitted with its owning form as part of a name/value pair. |
required | boolean | — | When `true`, indicates that the user must set the value before the owning form can be submitted. |
asChild | boolean | — | Change the default rendered element for the one passed as a child, merging their props and behavior. |
as | AsTag | Component | 'div' | The element or component this component should render as. Can be overwrite by `asChild` |
Emits
| Emit Name | Parameters | Description |
|---|---|---|
update:modelValue | string | Emitted when the model value changes. |
update:color | NormalizedColor | Emitted when the color value changes. |
change | string | Emitted when change occurs. |
changeEnd | string | Emitted when change end occurs. |
ColorAreaArea
Props
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Change the default rendered element for the one passed as a child, merging their props and behavior. |
as | AsTag | Component | 'div' | The element or component this component should render as. Can be overwrite by `asChild` |
ColorAreaCompact
Props
| Prop | Type | Default | Description |
|---|---|---|---|
areaProps | ColorAreaAreaProps | — | Properties forwarded to the area element. |
thumbProps | ColorAreaThumbProps | — | Properties forwarded to the thumb element. |
modelValue | import("@soybeanjs/colord").AnyColor | — | Current model value. |
defaultValue | import("@soybeanjs/colord").AnyColor | — | Default value. |
colorSpace | ColorSpace | — | Color space. |
format | ColorFormat | — | Format. |
xChannel | ColorAreaAxisChannel | — | X channel. |
yChannel | ColorAreaAxisChannel | — | Y channel. |
disabled | boolean | — | Whether the component is disabled. |
xName | string | — | X name. |
yName | string | — | Y name. |
name | string | — | The name of the field. Submitted with its owning form as part of a name/value pair. |
required | boolean | — | When `true`, indicates that the user must set the value before the owning form can be submitted. |
asChild | boolean | — | Change the default rendered element for the one passed as a child, merging their props and behavior. |
as | AsTag | Component | 'div' | The element or component this component should render as. Can be overwrite by `asChild` |
Emits
| Emit Name | Parameters | Description |
|---|---|---|
update:modelValue | string | Emitted when the model value changes. |
update:color | NormalizedColor | Emitted when the color value changes. |
change | string | Emitted when change occurs. |
changeEnd | string | Emitted when change end occurs. |
ColorAreaRoot
Props
| Prop | Type | Default | Description |
|---|---|---|---|
modelValue | import("@soybeanjs/colord").AnyColor | — | Current model value. |
defaultValue | import("@soybeanjs/colord").AnyColor | — | Default value. |
colorSpace | ColorSpace | — | Color space. |
format | ColorFormat | — | Format. |
xChannel | ColorAreaAxisChannel | — | X channel. |
yChannel | ColorAreaAxisChannel | — | Y channel. |
disabled | boolean | — | Whether the component is disabled. |
xName | string | — | X name. |
yName | string | — | Y name. |
name | string | — | The name of the field. Submitted with its owning form as part of a name/value pair. |
required | boolean | — | When `true`, indicates that the user must set the value before the owning form can be submitted. |
asChild | boolean | — | Change the default rendered element for the one passed as a child, merging their props and behavior. |
as | AsTag | Component | 'div' | The element or component this component should render as. Can be overwrite by `asChild` |
Emits
| Emit Name | Parameters | Description |
|---|---|---|
update:modelValue | string | Emitted when the model value changes. |
update:color | NormalizedColor | Emitted when the color value changes. |
change | string | Emitted when change occurs. |
changeEnd | string | Emitted when change end occurs. |
ColorAreaThumb
Props
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Change the default rendered element for the one passed as a child, merging their props and behavior. |
as | AsTag | Component | 'div' | The element or component this component should render as. Can be overwrite by `asChild` |
Notes
Architecture and benchmark differences
ColorAreaCompact owns the area/thumb composition while every primitive stays style-free and only the UI wrapper injects the colorAreaVariants classes. This mirrors radix-ui-color/shadcn-ui headless split. Ant Design, Element Plus, Mantine and Naive UI ship a full color-picker with an embedded saturation plane; VeanUI exposes the area as a standalone configurable primitive with axis-channel, color-space and format control, plus native form inputs and a size scale.
| Capability | VeanUI | shadcn/ui | Ant Design | Element Plus | Mantine | Naive UI |
|---|---|---|---|---|---|---|
| Aria/styled split | ✅ | ✅ | — | — | — | — |
| Configurable axes | ✅ | ✅ | — | — | — | — |
| Multiple color spaces | ✅ | ✅ | — | — | ✅ | — |
| Keyboard interaction | ✅ | ✅ | ✅ | ✅ | ✅ | — |
| Native form inputs | ✅ | ✅ | — | — | — | — |
| Sizes (6) | ✅ | — | — | — | — | — |
— = unsupported or a different interaction model (most ship a single combined color-picker).
Cautions
modelValueaccepts a color string orColorValue;formatcontrols the emitted string format.xChannel/yChannelmust be distinct and valid for the chosencolorSpace(e.g.chroma+lightnessin OKLCH).- The component emits
update:modelValue,update:color,changeandchangeEnd;changeEndfires on pointer/keyboard commit. - Provide
xName/yNameto submit the underlying channels as hidden form fields. - Use with
color-slider(hue) and acolor-fieldfor a complete picker.
Roadmap
N/A — color-area is feature-complete for the current parity set.
FAQ
How do I use a color area?
Set model-value, format and the axis channels:
<SColorArea model-value="hsl(0 50% 50%)" format="hsl" @update:model-value="onChange" />How do I configure the axes?
Use x-channel/y-channel:
<SColorArea
model-value="oklch(62% 0.22 312)"
color-space="oklch"
format="oklch"
x-channel="chroma"
y-channel="lightness"
/>How do I pair it with a hue slider?
Combine with SColorSlider for the hue channel:
<SColorArea v-model:model-value="color" format="hsl" />
<SColorSlider v-model:model-value="color" channel="hue" format="hsl" />