Command Palette

Search for a command to run...

Docs
Color Picker Input

Color Picker Input

A color picker with swatches, opacity control, and hex code display

Loading...

Installation

Props

PropTypeDefaultDescription
colorsstring[][12 preset colors]Array of hex color codes for the swatches
initialColorstring"#3B82F6"Initial selected color
initialOpacitynumber100Initial opacity percentage (0-100)
onChange(color: string, opacity: number) => void-Callback when color or opacity changes

Examples

Custom Initial Values

<ColorPickerInput
  initialColor="#EC4899"
  initialOpacity={80}
  onChange={handleColorChange}
/>

With Custom Colors

const customColors = [
  "#000000",
  "#FFFFFF",
  "#FF0000",
  "#00FF00",
  "#0000FF",
  "#FFFF00",
  "#FF00FF",
  "#00FFFF",
];
 
<ColorPickerInput
  colors={customColors}
  onChange={(color, opacity) => console.log(color, opacity)}
/>;