RadioGroup
Choose exactly one option from a small visible set.
Inline colour picker for theming and branding settings: saturation/brightness area, hue track, optional opacity track, hex Input, and optional preset swatches. One piece, no popover.
Inline colour picker: saturation and brightness area, hue, optional opacity, a hex Input, and preset swatches. The picked colour is user data, painted with inline style; all chrome uses tokens. Not ColorArea, HueSlider, or input type=color.
Drag the area or hue, use the arrow keys (Shift for ×10), pick a swatch, or type a hex. Current value: #2F6FEB
The area is one 2D slider: left and right set saturation, up and down set brightness. Hue and opacity are sliders. Swatches are a radio group with one Tab stop. A full hex applies as you type; an invalid hex shows a message and keeps the last valid colour. With opacity, onChange returns #RRGGBBAA below 100%.
import { ColorPicker } from "agentic-ds-kit";From contracts/colorpicker.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.
| Name | Type | Required | Default | Notes |
|---|---|---|---|---|
| value | string | No | — | Controlled hex. #RRGGBB, or #RRGGBBAA when showAlpha and opacity is below 100%. Accepts #RGB / #RGBA / #RRGGBB / #RRGGBBAA, case-insensitive. |
| defaultValue | string | No | — | Uncontrolled starting hex. With neither value nor defaultValue the picker starts at black. |
| onChange | function | No | — | (hex: string) => void. Uppercase #RRGGBB, or #RRGGBBAA with showAlpha below 100% opacity. Fires on every committed change (drag, keys, swatch, valid hex). |
| swatches | array | No | — | (string | { value, label? })[]. Preset colours shown as a radio group. The label is the accessible name; without it the hex is read out. |
| showAlpha | boolean | No | false | Adds an opacity track over a checkerboard and a percent readout. |
| disabled | boolean | No | false | — |
| id | string | No | — | Hex Input id. Inside Field, pass the same value as htmlFor so the Field label names the hex Input. |
| describedBy | string | No | — | Set by Field (hint or error id). |
| error | boolean | No | false | Set by Field when it has an error. Danger border on the hex Input. |
| ariaLabel | string | No | Colour | Names the group and prefixes the slider names: '{ariaLabel} saturation and brightness', '{ariaLabel} hue', '{ariaLabel} opacity', '{ariaLabel} presets'. Use the Field label text, e.g. 'Brand colour'. |
| invalidMessage | string | No | Enter a hex colour like 3366FF. | Shown under the hex Input while the typed text is not a valid hex. The last valid colour is kept. |