ColorPicker
<ColorPicker>TailwindCSS ModulesUntitled UI–style solid color pickers (spectrum, minimal, swatches, brand/gray, palette) plus a separate GradientPicker for multi-stop linear/radial gradients, and standalone hue/alpha sliders.
npx coloxo add color-picker --style coloxo-cssimport { ColorPicker, GradientPicker, ColorHueSlider, ColorAlphaSlider } from '@coloxo/ui';Design Tokens:
1. Variant Matrix
ColorPicker variants for solid colors; GradientPicker is a separate component type.
| Solid | Gradient | Swatches | Brand | Minimal | Palette | |
|---|---|---|---|---|---|---|
| Inline | linear-gradient(90deg, #2348ff 0%, #db2777 100%) | brand gray red orange amber yellow lime green teal cyan blue indigo violet purple fuchsia pink rose |
2. Control heights (Sizes)
Trigger field heights match other Coloxo form controls (sm / md / lg).
Sizes
size="sm"Dense toolbars, table cells
size="md"DEFAULTStandard forms & settings
size="lg"Hero brand / theme panels
3. Features
Standalone GradientPicker, hue/alpha sliders, saved swatch sizes, format switching, and eye dropper.
GradientPicker (separate type)
linear-gradient(90deg, #2348ff 0%, #db2777 100%)
Hue slider
Transparency slider
Saved swatches — small
Saved swatches — medium
Popover trigger (field)
Opens the solid spectrum picker.
4. Interactive Props Configurator
Show alpha
Eye dropper
Inline panel
Selected: #2348ff
<ColorPicker value="#2348ff" onChange={setColor} inline label="Brand color"/>5. Dark theme
Panel surfaces, borders, and inputs follow `[data-cx-theme]` tokens.
6. Enterprise layout compositions
Typical product placements — theme settings and tag / category colors.
Accessibility
Color area, sliders, and swatch grid use React Aria keyboard and pointer interactions with proper ARIA roles.
Thumbs, swatches, and format fields show Coloxo brand focus rings for keyboard users.
Chromium EyeDropper API when available; the control is omitted in unsupported browsers.
Props
| Name | Type | Default | Description |
|---|---|---|---|
| value / defaultValue | string | #2348ff | CSS / hex color string. |
| onChange | (hex: string, color: Color) => void | — | Color change handler. |
| variant | "solid" | "minimal" | "swatches" | "brand" | "gray" | "palette" | solid | Solid ColorPicker panel layout. Use GradientPicker for gradients. |
| size | "sm" | "md" | "lg" | md | Trigger field height. |
| swatches | string[] | — | Custom swatch list for swatches/brand/gray. |
| swatchSize | "sm" | "md" | md | Saved swatch cell size. |
| showAlpha | boolean | true | Show transparency slider. |
| showEyeDropper | boolean | true | Chromium EyeDropper button. |
| format / defaultFormat | "hex" | "rgb" | "hsl" | "hsb" | hex | Value input model. |
| inline | boolean | false | Render panel without popover. |
| hideTrigger | boolean | false | Panel only (use with inline). |
| label / description / error | ReactNode | — | FormField chrome. |