Pro unlocks unlimited templates48:00:00Get Pro →

Color Picker

Pick colors with a saturation panel, hue slider, optional opacity, swatches, copy, and EyeDropper. Supports HEX, RGB, HSL, and alpha formats.

Basic

Saturation panel, hue slider, and color input.

Loading…

Installation

CLI
npx @sonojs/ui@latest add color-picker
Also needs
npx @sonojs/ui@latest add button input-group slider
npm i lucide-react

Usage

color-picker.tsx
import { ColorPicker } from "@/components/color-picker"

export function Example() {
  return <ColorPicker defaultValue="#2563EB" showSwatches />
}

Props

PropTypeDefaultDescription
value / defaultValue / onValueChangestring"#3B82F6"Controlled or uncontrolled color string.
format / defaultFormat / onFormatChangeColorFormat"hex"Output format for the text field and callbacks.
showOpacitybooleanfalseShow the alpha slider.
showSwatchesbooleanfalseShow the preset swatch grid.
showEyeDropperbooleanfalseShow pipette when `window.EyeDropper` exists (Chromium).
showCopy / showFormatSelectbooleantrueCopy button and format chips.
compactbooleanfalseNarrower panel for popovers and forms.
disabled / readOnlybooleanfalseLock interaction.

Related

  • Input — text fields
  • Popover — wrap the picker in a form
  • Slider — hue and opacity tracks