ColorPicker

Pick solid colors with an HSV canvas and hex input, or build CSS linear gradients with draggable stops and an angle control. Supports presets, three sizes, and controlled / uncontrolled usage.

Playground
mode
size
showInput
showPresets
showArrow
showColorCode
disabled
<ColorPicker onChange={(value) => console.log(value)} />

Solid mode

Set mode="solid" to only expose the flat-color picker, no gradient tab.

#0285F7

Gradient mode

Set mode="gradient" to show only the gradient editor. Click the bar to add stops, drag to reposition, select a stop to edit its color.

linear-gradient(90deg, #0285F7 0%, #8B5CF6 100%)

Both modes (tabs)

Default mode shows Solid and Gradient tabs. Switching tabs converts the current value automatically.

#22C55E

Sizes

Three sizes to fit different layout densities.

Custom presets

Pass your own brand palette via the presets prop.

Without input / without presets

Control which picker UI elements are visible with showInput and showPresets.

Trigger: hide arrow / color code

showArrow and showColorCode let you strip down the trigger to just the swatch.

Trigger: custom radius

Pass triggerRadius to override the border-radius of the trigger button.

Custom trigger

Pass trigger as a ReactNode or render-prop receiving { open, value } to replace the default button entirely.

Disabled

The picker is non-interactive and visually muted when disabled.

API

PropertyTypeDefaultDescription
valuestringControlled value: hex string (#RRGGBB) for solid or CSS linear-gradient() for gradient
defaultValuestringInitial value for uncontrolled usage
onChange(value: string) => voidCalled whenever the color changes
mode"solid" | "gradient" | "both""both"Which modes to allow. "both" renders Solid/Gradient tabs
size"sm" | "md" | "lg""md"Size of the trigger button
disabledbooleanfalseDisable the picker
presetsstring[]12 defaultsQuick-access color preset swatches
showInputbooleantrueShow the hex input field inside the popover
showPresetsbooleantrueShow the preset color swatches inside the popover
showArrowbooleantrueShow the chevron arrow on the trigger button
showColorCodebooleantrueShow the hex color code text on the trigger button
triggerRadiusstring | numberCustom border-radius for the trigger button (number → px, string → as-is)
triggerReactNode | ((state: { open: boolean; value: string }) => ReactNode)Replace the default trigger button with a custom element or render prop
placeholderstring"Pick a color"Trigger placeholder text when no value
classNamestringExtra className on the root element