ColorPicker

Saturation field and hue strip with jelly thumbs on springs. Edit the hex, pick a swatch, or use arrow keys. Inputs.

Open playground

About

ColorPicker is a React component in the Inputs category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { ColorPicker } from "@ashutoshswamy/smoui" and set value, onChange, swatches.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { ColorPicker } from "@ashutoshswamy/smoui";

<ColorPicker defaultValue="#5b6cff" onChange={(hex) => setColor(hex)} />

Props 3

value / defaultValue

Hex color, controlled or initial.

stringdefault "#5b6cff"
onChange

Called as the color changes.

(hex: string) => void
swatches

Preset colors. Shift+arrows take bigger steps.

string[]