Import
Usage
Props
The current color value as a hex string (e.g.,
#FF5733).Callback fired when the color changes. Receives the new color as a hex string.
Array of preset color swatches to display. Defaults to a curated set of 14 colors including pastels, vibrant colors, and grayscale.
Position of the color preview relative to the hex input field.
left/right: Small square preview beside inputtop/bottom: Thin bar above/below inputfull: Input background is the color with adaptive text color
Layout direction for the color picker. When true, elements are arranged horizontally.
Whether to show the hex input field and color preview.
HTML id attribute for the color picker container.
Object-based class names for conditional styling.
Examples
Behavior
The color picker validates hex input and only accepts valid 6-digit hex colors. Invalid input is ignored. The component uses HSV color space internally for smooth gradient transitions.
Features
- Saturation/Brightness Gradient: Drag to select color saturation and brightness
- Hue Slider: Vertical slider to select the base hue
- Preset Swatches: Click any preset color for instant selection
- Random Color Button: Shuffle icon generates random colors
- Hex Input: Direct hex code entry with validation
- Touch Support: Full touch and mouse event support
- Smart Text Color: In full preview mode, text color adapts based on background brightness