Skip to content
Forms

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.

PortedParity: MatchGeometry 1/1Pixel diff 0 pxLogic 1/1Parity scoreboard
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

Skip ColorPickerProps props table
PropTypeDefaultDescription
value
string—Controlled color as a CSS color string (ideally `oklch(l c h)`).
defaultValue
stringDEFAULT_VALUEInitial 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
booleanfalseDisables 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.