OGE logoOGE

Color Box

A color editor on the shared field chrome: the field shows a live swatch and the committed CSS color string; the popup composes a saturation/brightness surface, hue/alpha sliders, hex + channel inputs and an optional swatch palette. No WAI-ARIA APG color-picker pattern exists, so the popup is built from primitives — a role="dialog" that takes real DOM focus, APG sliders with mandatory aria-valuetext, a 2-axis surface with aria-roledescription, and a role="grid" palette.

For a plain form field with no format control, palette or alpha, the native <input type="color"> is smaller and fully accessible out of the box — reach for this editor when you need the string format contract, typed CSS color input, swatch governance or the draft/OK commit flow.

composed a11y CSS color parsing Signal Forms useButtons

Getting started

The committed value is a CSS color string — bind it straight to styles. Opening moves DOM focus onto the gradient surface; Escape restores it to the input. In Chromium the panel also offers an eyedropper (the EyeDropper API — progressive enhancement, no polyfill). valueCommitted reports every change with previousValue.

value swatch dialog focus

Value: #3aa0ff

Formats and alpha

format: 'hex' | 'rgb' | 'rgba' | 'hsl' fixes the committed shape (hex default — the DevExtreme choice). editAlphaChannel adds the alpha slider and input; translucent colors widen the output to carry alpha, opaque ones stay compact. Without it alpha is coerced to 1 on commit.

format editAlphaChannel alpha widening

Overlay: rgba(58, 160, 255, 0.5) — Accent: hsl(210, 100%, 61%)

Palette view

view: 'gradient' | 'palette' | 'both'. The palette is an APG grid — roving tabindex, arrow/Home/End/Ctrl+Home navigation, Enter/Space picks and closes. The selected cell's checkmark picks black or white by WCAG contrast against the swatch.

view palette role=grid

Apply with buttons

applyValueMode: 'useButtons' collects panel interactions in a draft and commits only on OK; Cancel, Escape or an outside click discards — the date box's exact contract, with Kendo's committed | draft preview pair in the footer. The default 'instantly' commits live while dragging ([debounce] throttles the stream).

applyValueMode draft OK/Cancel

Typed colors

Typed text parses any CSS color — hex in all four lengths, rgb()/rgba() in comma and space/slash syntax, hsl(), the named colors, transparent. Commits normalize to format; unparseable text shows the invalid state while typing and reverts on blur. acceptCustomValue=false makes the text read-only.

CSS parsing named colors revert on blur

Inside a form

A chrome'd editor: editorType: 'colorBox' with colorFormat, editAlphaChannel, view and palette under editorOptions. Works in all three form bindings.

editorType: colorBox editorOptions

Model: #3aa0ff