A colour setting in one row
The name sits on the left, and the hex reading and a round swatch sit at the bar’s end. It is the library ColorPicker with its trigger dressed as an inspector bar, so the panel, with its saturation area, hue slider and hex field, is ColorPicker’s own. A click anywhere on the bar, the name included, opens the panel.
Sizes
The size prop matches Button’s: default is 40px tall and compact is 32px. The swatch is one line of text tall, so it sits concentric with the bar’s rounded end.
Alpha
Set showAlpha to add an opacity slider to the panel. Below full opacity the reading and the emitted value become 8-digit hex, and the swatch shows the colour over a checkerboard.
Disabled
When to use it
Use the inspector colour picker for a colour setting in a dense panel, usually inside an inspector section, whose open body lets the panel open past its edge. For a fixed set of colours, a row of swatches is quicker to pick from. For a form field with a label above and helper text below, use ColorPicker itself.
Props
Read from the same JSDoc that ships in the package's types. A required prop is marked with an asterisk.
| Prop | Type | Default | Description |
|---|---|---|---|
label* | string | The setting's name, drawn inside the bar on the left. Also the start of the trigger's accessible name. | |
value | string | Current colour as a hex string — 3, 6 or 8 digit, with or without `#`. | |
defaultValue | string | Initial colour for uncontrolled use. | |
onValueChange | ((value: string) => void) | Called with the colour as an uppercase hex string (`#RRGGBB`, or
`#RRGGBBAA` when `showAlpha` and alpha is below 100%). Fires live while
dragging, as in ColorPicker. | |
showAlpha | boolean | false | Add an alpha (opacity) slider to the panel and emit 8-digit hex when alpha is below 100%. |
name | string | When set, a hidden input carries the current hex under this name, so the picker joins native form submission. | |
disabled | boolean | false | Whether the picker is disabled. |
size | "default" | "compact" | 'default' | Component size, matching Button: `default` is 40px tall, `compact` 32px. |
className | string | '' | Additional CSS classes, applied to the wrapper. |
Keys
It is ColorPicker in the inspector’s dress: opening moves focus onto the colour area, where the arrow keys move both axes, and Escape closes the panel with focus back on the swatch. ColorPicker’s stories test these keys.
// From the npm package
import { InspectorColorPicker } from 'rift-ds/components/InspectorColorPicker/InspectorColorPicker';
// Or as source you own, via the shadcn CLI
npx shadcn@latest add https://rift-ds.com/r/inspector-color-picker.json5.1 kB gzipped, with everything it imports. Peer dependencies are not counted.
For agents: the props, their allowed values and defaults, and the tested keys, as markdown or as a JSON schema.