npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-color-picker.json --yesColor picker
ProA painted area and channel sliders that choose one colour, for React and Tailwind CSS. Part of Goop Pro.
What an agent sees
import { ColorPicker } from '@/components/ui/goop/color-picker';
import { useState } from 'react';
import { Field } from '@/components/ui/goop/field';
function LabelColour() {
const [colour, setColour] = useState('eb5757');
return (
<>
<div className="flex items-center gap-1.5">
<ColorPicker label="Label colour" value={colour} onValueChange={setColour} />
<span>Interview follow-up</span>
</div>
<Field label="Project colour" orientation="vertical">
<ColorPicker variant="field" label="Project colour" defaultValue="4cb782" alpha />
</Field>
</>
);
}Open a swatch, drag in the area or along the hue, type a value or pick a preset; the colours are read back, and which picker is open. The label and the project are our own sample rows; the colours are kept only on this page.
When to use
- A painted area and channel sliders that choose one colour.
- Also called: color input.
Installation
Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Color picker on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-color-picker.json --yesAdd the Goop Color picker to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { ColorPicker } from '@/components/ui/goop/color-picker';
import { useState } from 'react';
import { Field } from '@/components/ui/goop/field';
function LabelColour() {
const [colour, setColour] = useState('eb5757');
return (
<>
<div className="flex items-center gap-1.5">
<ColorPicker label="Label colour" value={colour} onValueChange={setColour} />
<span>Interview follow-up</span>
</div>
<Field label="Project colour" orientation="vertical">
<ColorPicker variant="field" label="Project colour" defaultValue="4cb782" alpha />
</Field>
</>
);
}- Fits: settings (its recipe).
- Also known as: ColourPicker, ColorInput, Input type="color", SwatchPicker.
- For a label's or a project's colour leave
variantout (the swatch,default) beside its name; in a settings form usevariant="field"inside a Field. Never a native colour input. - height, width, padding, gap, corner, border, background, shadow: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| value? | string | The colour, controlled: hex, rgb(…) or hsl(…) words. |
| defaultValue? | string | The first colour, uncontrolled. |
| onValueChange? | (value: string) => void | Hears the chosen colour as #rrggbb (#rrggbbaa when it is not opaque) on every change. |
| variant? | 'default' | 'field' = 'default' | default: the swatch, the quiet 24 px button with an 8 px dot; field: a 32 px button with a text field's edge, the colour and its value. |
| label? | string | Names the trigger and the panel; "Colour" by default. |
| name? | string | The form field's name: a hidden field sends the colour as #rrggbb (empty while none is chosen). |
| alpha? | boolean = false | Adds the opacity track. |
| presets? | readonly string[] | Colours to offer in a row under the field; nine label colours when left out, none when empty. |
| disabled? | boolean = false | Dims the trigger; nothing opens. |
| className? | string | Reaches the trigger. |
| open? | boolean | The panel open, controlled. |
| defaultOpen? | boolean | The panel open at first. |
| onOpenChange? | (open: boolean) => void | Hears the panel open and close. |
| container? | HTMLElement | null | Where the panel is portalled; the end of <body> when left out. |
| type? | 'button' | 'submit' | 'reset' | |
| onClick? | (event: MouseEvent) => void |
- State: value (value / defaultValue / onValueChange); open (open / defaultOpen / onOpenChange)
- data-slot values (to select a part by): color-picker, color-picker-dot, color-picker-field, color-picker-input, color-picker-item, color-picker-list, color-picker-panel, color-picker-plot, color-picker-thumb, color-picker-track, color-picker-value
Keyboard
| Key | What it does |
|---|---|
| Enter Space | Open the panel |
| Arrow keys | Move the area's thumb 1 % (with Shift 10 %): across for saturation, up and down for brightness |
| Home End | Saturation to none or full |
| PageUp PageDown | Brightness to full or none |
| Enter (in the field) | Apply the typed value; unreadable words stay, marked invalid |
| Arrow keys (in the presets) | Move to the next swatch and choose it |
| Escape | Close the panel and return to the trigger |
Accessibility
- The native element answers the keyboard.
- focus-visible: the browser's own (:focus-visible): write nothing
Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:
| State | Drawn by |
|---|---|
| checked | the attribute aria-checked |
| indeterminate | the attribute aria-checked |
Notes for AI
Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.