Color Picker
Hex color field with an Apple 27 color well — a swatch button opens a Liquid Glass panel (spectrum, hue track and system color swatches) on desktop and an iOS 27 bottom Drawer on mobile.
ColorPicker is a form field made of three parts: a round swatch button (shows the current color, or a red slash when empty), a hex Input and a clear button. The swatch opens the color panel through Popover, so it adapts automatically:
- Desktop (
>= 768px· macOS 27): a floating Liquid Glass popover with a10pxspectrum, a capsule hue track and26pxswatches. - Mobile (
< 768px· iOS 27): the standard edge-to-edge bottom Drawer with a larger44pt-friendly spectrum,28ptknobs and36ptswatches.
The spectrum is react-colorful (2.8 KB), restyled to the Apple color well. Swatches default to the Apple 27 system colors (red, orange, yellow, green, mint, teal, cyan, blue, indigo, purple, pink, brown).
Live Preview
Installation (Shadcn Registry)
# Install via the @apple-liquid namespace (includes button, input, popover, react-colorful and liquid-glass)
npx shadcn@latest add @apple-liquid/color-picker
# Or install directly via URL
npx shadcn@latest add https://your-domain.com/r/color-picker.jsonInline Panel
ColorPickerPanel is the spectrum + swatches on their own, for inspectors and editor menus that must keep their own selection:
Sizes, Presets & States
size="sm" matches the small Input; presets replaces the swatches (pass [] to hide them). readOnly keeps the swatch at full strength but never opens the panel; disabled dims everything. Typing #abc is expanded to #AABBCC on blur:
Usage
import { ColorPicker, ColorPickerPanel } from '@/components/ui/color-picker';
export function Example() {
const [color, setColor] = React.useState('#0088FF');
return (
<>
<ColorPicker name="tagColor" title="Tag color" value={color} onValueChange={setColor} />
<ColorPickerPanel value={color} onValueChange={setColor} />
</>
);
}Props API
ColorPicker
Other props (id, name, aria-*, onBlur, …) go to the hex Input, so it works inside Field like any input.
| Prop | Type | Default | Description |
|---|---|---|---|
value / defaultValue / onValueChange | string | '' | Hex color; an empty string means no color |
title | ReactNode | 'Color' | Panel title (mobile Drawer header) |
presets | readonly string[] | Apple 27 system colors | Swatches; [] hides them |
allowClear | boolean | true | Clear button once a color is set |
size | 'default' | 'sm' | 'default' | Mobile 44px / 36px ↔ desktop 34px / 28px |
glass | boolean | true | Swatch button and input material; false renders them opaque (Bordered) |
disabled / readOnly | boolean | false | Disabled dims everything; read-only shows the color but can't change it |
inputClassName | string | — | Classes for the hex input (className goes to the wrapper) |
ColorPickerPanel
| Prop | Type | Default | Description |
|---|---|---|---|
value / defaultValue / onValueChange | string | '' | Hex color |
presets | readonly string[] | Apple 27 system colors | Swatches |
disabled | boolean | false | Dims and locks the panel |
COLOR_PICKER_PRESETS (the default swatches) is exported as well.
Language & Text
ColorPicker, ColorPickerPanel accept locale and messages, which apply to all of its parts and the overlays it opens and win over the global <LiquidGlassProvider locale messages>. To override the text globally, put it under messages.colorPicker on the provider. See Liquid Glass → Global settings.
| Prop | Type | Description |
|---|---|---|
locale | LiquidGlassLocaleInput | UI language of this component (any BCP 47 tag; unsupported ones fall back to English) |
messages | Partial<ColorPickerMessages> | Text overrides, merged over the built-in text and the global messages.colorPicker |
| Key | Built-in text (English) |
|---|---|
trigger | Choose color |
title | Color |
placeholder | e.g. #0088FF |
clear | Clear color |
presets | Preset colors |
Collapsible
Unstyled disclosure container with built-in Apple 27 height easing and Reduced Motion support, ideal for sidebar folders and expandable detail panels.
Combobox
Responsive Apple Liquid Glass searchable selector featuring a pill macOS 27 glass input and floating dropdown on desktop, and automatically switching to an iOS 27 bottom Liquid Glass Drawer with search bar and grouped list on mobile.