Skip to content
THE COMPONENT LIBRARY
Skip to content

Component reference

ColorPicker

Edit two brand colors with a live visual preview.

Preview

Live preview

Changes apply to this preview only.

Brand color
Accent color
Pimolu Studio

#5B55E7 · #0EA5E9

A live preview of the two selected tokens. The picker reports uppercase #RRGGBB values.

Width adapts to the available space

More examples

Different configurations and compositions using the real Pimolu API. Each preview runs independently and follows the site appearance.

Sizes

sm, md and lg scale the trigger, the swatch and the value together.

Open preview

Presets

The presets prop accepts any readable array; invalid entries are filtered out and each swatch has an accessible name.

Open preview

States

An external error marks the control invalid; read-only keeps the value inspectable; disabled closes every entry point.

Open preview

Usage

Use presets for suggestions and the editable color value for additional choices.

API reference

Generated from the public TypeScript declarations. Native HTML attributes are inherited where the component extends them; this reference includes Pimolu props and selected common native attributes.

PimoluColorPickerProps

Type source
PimoluColorPickerProps public API
NameTypeDefaultDescription
valuestring | undefined—Controlled hex color, for example `"#5B55E7"`.
defaultValuestring | undefined`"#5B55E7"`Initial hex color when uncontrolled. Defaults to `"#5B55E7"`.
onValueChange((value: string) => void) | undefined—Called with the next color, normalized to an uppercase `#RRGGBB` string.
presetsreadonly string[] | undefineda small cross-theme palettePreset swatches. Each entry must be a valid hex color. Defaults to a small cross-theme palette.
disabledboolean | undefinedfalseDisable the trigger entirely.
readOnlyboolean | undefinedfalseKeep the value visible but prevent every change.
labelstring | undefined—Visible label, also used to name the trigger.
errorReactNode—Error text; also marks the control as invalid.
sizePimoluColorPickerSize | undefined"md"Visual size. Defaults to "md".
classNamestring | undefined—Standard React/HTML attribute.
styleCSSProperties | undefined—Standard React/HTML attribute.
aria-labelstring | undefined—Defines a string value that labels the current element.
childrenReactNode—Standard React/HTML attribute.
onClickMouseEventHandler<HTMLDivElement> | undefined—Standard React/HTML attribute.
value

string | undefined

No default extracted.

Controlled hex color, for example `"#5B55E7"`.

defaultValue

string | undefined

Default: `"#5B55E7"`

Initial hex color when uncontrolled. Defaults to `"#5B55E7"`.

onValueChange

((value: string) => void) | undefined

No default extracted.

Called with the next color, normalized to an uppercase `#RRGGBB` string.

presets

readonly string[] | undefined

Default: a small cross-theme palette

Preset swatches. Each entry must be a valid hex color. Defaults to a small cross-theme palette.

disabled

boolean | undefined

Default: false

Disable the trigger entirely.

readOnly

boolean | undefined

Default: false

Keep the value visible but prevent every change.

label

string | undefined

No default extracted.

Visible label, also used to name the trigger.

error

ReactNode

No default extracted.

Error text; also marks the control as invalid.

size

PimoluColorPickerSize | undefined

Default: "md"

Visual size. Defaults to "md".

className

string | undefined

No default extracted.

Standard React/HTML attribute.

style

CSSProperties | undefined

No default extracted.

Standard React/HTML attribute.

aria-label

string | undefined

No default extracted.

Defines a string value that labels the current element.

children

ReactNode

No default extracted.

Standard React/HTML attribute.

onClick

MouseEventHandler<HTMLDivElement> | undefined

No default extracted.

Standard React/HTML attribute.

Accessibility

  • Give color values readable names and verify contrast after customization; a swatch alone is not a label.
Read the accessibility guide →