Color Area
A two-dimensional color selector.
Anatomy
#thumb: Custom visual thumb content. Receivesvalue,x, andy. It is decorative; native range inputs retain keyboard semantics.
Usage
Hue and saturation
Choose hue and saturation in the area. Lightness includes black and white; Opacity controls transparency.
Output format
Choose the format for the returned value. The area still edits hue and saturation.
RTL and disabled
RTL reverses the horizontal axis. Disabled areas remain visible without accepting edits.
Examples
Hue and saturation
Drag left or right to change hue, and up or down to change saturation. Use Lightness for black (0%) or white (100%), and Opacity for transparency. This example uses HSL; the default area uses HSB saturation and brightness.
<Dialog
:ui="{
overlay: 'fixed inset-0 bg-black/50 backdrop-blur-sm',
content: 'bg-white rounded-xl shadow-xl w-full max-w-md',
header: 'flex items-center justify-between p-6 border-b',
body: 'p-6',
footer: 'flex justify-end gap-2 p-6 border-t',
}"
>
Put v-model and format on ColorPicker to share one color between the area and sliders. Leave the child controls without their own models. This keeps hue and saturation when you pass through black, white, or transparent. You can also use ColorArea on its own.
Output format
Choose the format for the returned value. Selecting OKLCH returns an oklch(...) string. The area still edits HSL hue and saturation.
<template>
<Avatar
src="/avatar.jpg"
alt="Jane Doe"
text="JD"
:delay-ms="300"
/>
</template>
RTL and disabled
RTL reverses the horizontal hue axis. The disabled example shows the area and both sliders but prevents editing.
<Button
:ui="{
root: 'rounded-md bg-black px-3 py-2 text-white',
spinner: 'size-4 animate-spin',
}"
>
Save
</Button>
See the live demo's code for the state and style objects used in these examples.
Pass disabled to custom slot controls as shown above. To show keyboard focus on slider handles, use peer outline-none on ui.axis and peer-data-[akaza-focus-visible] classes on ui.thumb.
Formats
Set format to choose the returned color string. It does not change which colors you can enter or which channels you edit. See supported formats. Changing the format keeps opacity and emits value-change with reason format. HEX uses eight digits for transparent colors; hexa uses eight digits for all colors.
Use colorSpace, xChannel, and yChannel to change what the area edits. You do not need to change these props to choose a different output format.
HEX and RGB can lose colors outside sRGB. The control keeps the original color until you replace the model or enter a new value. Area and slider previews use sRGB. See precision and gamut for details.
Use a color value such as #56d799 or oklch(0.65 0.2 250). CSS variables, currentColor, and relative color expressions are not supported.
Behavior
The area has two native range inputs, one per axis, and one visible thumb. Drag to change both channels. Press Tab to focus each channel and use the keyboard to edit it. Disabled and read-only controls prevent changes.
Choose two different channels from the same color space, such as RGB red/green or OKLCH chroma/lightness. Unsupported or repeated channels disable the area. The preview uses sRGB, but the value can contain colors outside sRGB. Opacity stays unchanged unless you choose alpha as an axis.
API Reference
Props
| Prop | Type | Default | Purpose |
|---|---|---|---|
modelValue | string | "#ff0000" | Selected CSS color. Bind with v-model. |
format | ColorFormat | "hex" | Format for the returned and submitted color string. |
id, name | string | From Field | Input ID and form field name. |
required, disabled, readOnly, invalid | boolean | false | Native validation and interaction states; disabled/required also inherit from Field. |
ariaLabel, ariaLabelledby, ariaDescribedby | string | From Field where applicable | Accessible naming and description. |
ui | Component UI object | - | Classes for the named parts below. |
colorSpace | ColorSpace | "hsb" | Editing space. |
xChannel, yChannel | ColorChannel | "saturation", "brightness" | Distinct channels supported by the editing space. |
xLabel, yLabel | string | Generated from channel names | Names for the two accessible sliders. |
xName, yName | string | - | Optional separate numeric channel form values. |
step | number | Channel default | Keyboard increment. |
dir | "ltr" | "rtl" | "ltr" | Reverse horizontal geometry and arrow direction. |
Emits
| Event | Payload | Meaning |
|---|---|---|
update:modelValue | Selected color | Vue model update. |
value-change | (value, details) | Runs before a change. Use details.cancel() to stop it. Includes reason and the native event when available. |
value-commit | (value, details) | Runs when an interaction ends. Canceling it does not undo the value change. |
Slots
#thumb: Custom visual thumb content. Receivesvalue,x, andy. It is decorative; native range inputs retain keyboard semantics.
UI Options
| Key | Element |
|---|---|
root | Group and pointer surface |
area | Canvas plane |
thumb | Visual thumb |
xInput | Horizontal keyboard control |
yInput | Vertical keyboard control |
input | Form input for the full color value |
Styling Hooks
| UI key | CSS class | Data attributes / semantics |
|---|---|---|
root | akaza-color-area | Shared form flags; data-akaza-dragging, data-akaza-color-space |
area | akaza-color-area-area | aria-hidden |
thumb | akaza-color-area-thumb | aria-hidden |
xInput | akaza-color-area-x-input | Native slider ARIA |
yInput | akaza-color-area-y-input | Native slider ARIA; vertical orientation |
input | akaza-color-area-input | Native validation attributes |
Form state attributes: data-akaza-disabled, data-akaza-readonly, data-akaza-invalid, data-akaza-focused, data-akaza-touched, data-akaza-dirty, data-akaza-filled, and data-akaza-out-of-gamut. Each appears only when true.
Use class or ui.root to style the root. Use the other ui keys for inner parts. Set sizes, borders, and colors in your own styles.
The thumb exposes --akaza-color but does not force a background. Use ui.thumb: 'bg-white' for a white handle, or bg-[var(--akaza-color)] for a color-filled handle.
Keyboard
| Key | Behavior |
|---|---|
Tab / Shift+Tab | Focus each of the area's two named sliders. The composed examples then continue to Lightness and Opacity. |
| Arrow keys | Adjust the focused channel; horizontal arrows reverse for the horizontal axis in RTL. |
PageUp / PageDown, Shift+Arrow | Adjust by ten steps. |
Home / End | Set the focused channel to its editor minimum/maximum. |
Parity Notes
ColorArea combines Reka's root, area, and thumb parts in one component. Use ui and #thumb to customize them. The supplied Base UI reference has no color area component.