Skip to content
SENVENLI UI

Color picker

A saturation-brightness area, hue (and alpha) sliders, a hex field and a two-theme preview of the primary button with its contrast.
A brand color
import { ColorPicker } from "@senvenli/react/color";

Examples

With an alpha slider

For a color that may be translucent, such as an overlay.

Save on release

`onChangeEnd` fires once per drag or commit: the place to save.

Guidelines

When to use it

  • Choosing a brand or theme color, where contrast in both themes matters.

Use something else when

Accessibility

Keyboard

KeysWhat happens
Arrow keysMove the area thumb or a slider by one step.
Page up / downMove by a larger step.

Built in

  • The label names the area, each slider and the hex field.
  • The preview announces the contrast ratio and what the theme uses when a tone fails.

You provide

  • A label.

API reference

ColorPicker

labelRequired
React.ReactNode

"Brand color"; names the area, the sliders and the hex field for screen readers.

value
string

The hex ("#1E63D0"); "#1E63D0CC" with an alpha channel.

defaultValue
stringDefault DEFAULT_PRIMARY
onChange
(value: string) => void

While dragging and typing: the preview and its contrast check follow every move.

onChangeEnd
(value: string) => void

On release (and when the hex field commits): save here, not on every move.

channels
readonly ("hue" | "alpha")[]Default ["hue"]

The sliders under the area: hue always, alpha when the color may be translucent.