Color Picker
OKLCH-native color input on a popover, with an area, hue slider and swatches.
Import
tsx
import { ColorPicker } from "@cronus-ui/ui";
bash
npx cronus-ui add color-picker
Examples
.cronus
The same component declared in Cronus. Emitted at build time from the audit fixtures — the kernel renders it as HTML with no React.
default.cronus
app "audit-fixtures" {
port 5176
}
style {
preset aurora
theme dark
}
component ColorPickerDefault layout:inline style:color-picker {
value:"oklch(0.62 0.21 256)"
aria-label:"Color"
label "Color"
}
page "/audit/color-picker/default" type:custom {
use ColorPickerDefault
}
API Reference
Generated from the component's exported types.
ColorPickerProps
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | Controlled color as a CSS color string (ideally `oklch(l c h)`). |
defaultValue | string | DEFAULT_VALUE | Initial color for uncontrolled usage. Defaults to a brand-ish oklch. |
onValueChange | (value: string) => void | — | Called with the new color, serialized as `oklch(l c h)`, on every change. |
swatches | string[] | DEFAULT_SWATCHES as unknown as string[] | Preset swatches shown as a row; clicking one selects it. |
disabled | boolean | false | Disables the trigger and all panel controls. |
aria-label | string | — | Accessible name for the trigger when there is no visible label. |
className | string | — | Extra classes for the trigger button. |
contentClassName | string | — | Extra classes for the popover panel. |
id | string | — | Native id for the trigger. |