Color Picker
A color selection component with spectrum picker, hue slider, HEX input, and preset swatches.
Overview
The ColorPicker component provides an interactive color selection experience with a trigger swatch, saturation/lightness spectrum, hue slider, HEX input field, and preset color swatches.
Installation
Install the component via the CLI in one command.
npx @work-rjkashyap/unified-ui add color-pickerpnpm dlx @work-rjkashyap/unified-ui add color-pickernpx @work-rjkashyap/unified-ui add color-pickerbunx @work-rjkashyap/unified-ui add color-pickerIf you haven't initialized your project yet, run npx @work-rjkashyap/unified-ui init first. See the CLI docs for details.
Or install the full package
Use this approach if you prefer to install the entire design system as a dependency instead of copying individual components.
npm install @work-rjkashyap/unified-uipnpm add @work-rjkashyap/unified-uiyarn add @work-rjkashyap/unified-uibun add @work-rjkashyap/unified-uiAnatomy
import { ColorPicker } from "@work-rjkashyap/unified-ui";Examples
Default
Sizes
Custom Presets
Disabled
Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | Controlled HEX color value. |
defaultValue | string | "#000000" | Default color for uncontrolled mode. |
onChange | (color: string) => void | — | Callback when the color changes. |
presets | string[] | 18 defaults | Preset color swatches to display. |
showInput | boolean | true | Whether to show the HEX input field. |
disabled | boolean | false | Whether the picker is disabled. |
size | "sm" | "md" | "lg" | "md" | Size of the trigger swatch. |
label | string | "Choose color" | Accessibility label for the trigger. |
className | string | — | Additional CSS classes. |
Accessibility
- Trigger button has
aria-label,aria-expanded, andaria-haspopupattributes. - Popover closes on
Escapekey and outside click. - Hue slider and spectrum area are keyboard navigable.
- HEX input validates on blur.
File Upload
A drag-and-drop file upload zone with file list, progress tracking, image preview thumbnails, and animated transitions.
Badge
A compact label component for categorization, status indicators, metadata display, and interactive tags. Supports 8 semantic variants, dot indicators, avatars, icons, dismissible state, and optional Framer Motion animation.