Skip to Content
Liquid Glass UI
Components

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 a 10px spectrum, a capsule hue track and 26px swatches.
  • Mobile (< 768px · iOS 27): the standard edge-to-edge bottom Drawer with a larger 44pt-friendly spectrum, 28pt knobs and 36pt swatches.

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

apple-liquid-ui/preview/color-picker-liquid-hero
MacBook · 16:10

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.json

Inline Panel

ColorPickerPanel is the spectrum + swatches on their own, for inspectors and editor menus that must keep their own selection:

apple-liquid-ui/preview/color-picker-panel
MacBook · 16:10

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:

apple-liquid-ui/preview/color-picker-states
MacBook · 16:10

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.

PropTypeDefaultDescription
value / defaultValue / onValueChangestring''Hex color; an empty string means no color
titleReactNode'Color'Panel title (mobile Drawer header)
presetsreadonly string[]Apple 27 system colorsSwatches; [] hides them
allowClearbooleantrueClear button once a color is set
size'default' | 'sm''default'Mobile 44px / 36px ↔ desktop 34px / 28px
glassbooleantrueSwatch button and input material; false renders them opaque (Bordered)
disabled / readOnlybooleanfalseDisabled dims everything; read-only shows the color but can't change it
inputClassNamestring—Classes for the hex input (className goes to the wrapper)

ColorPickerPanel

PropTypeDefaultDescription
value / defaultValue / onValueChangestring''Hex color
presetsreadonly string[]Apple 27 system colorsSwatches
disabledbooleanfalseDims 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.

PropTypeDescription
localeLiquidGlassLocaleInputUI language of this component (any BCP 47 tag; unsupported ones fall back to English)
messagesPartial<ColorPickerMessages>Text overrides, merged over the built-in text and the global messages.colorPicker
KeyBuilt-in text (English)
triggerChoose color
titleColor
placeholdere.g. #0088FF
clearClear color
presetsPreset colors

On this page