Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-color-swatch.json --yes

Color swatch

Pro

One colour pill, to pick a colour from a row of them or to show one on a menu's trigger, for React and Tailwind CSS. Part of Goop Pro.

When to use

  • One colour pill, to pick a colour from a row of them or to show one on a menu's trigger.

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

Terminal
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-color-swatch.json --yes
PROMPT
Add the Goop Color swatch to this project. The install steps are at https://goop.so/docs/install.md

Usage

TSX
import { ColorSwatch, ColorSwatchGroup } from '@/components/ui/goop/color-swatch';

const COLOURS = [
  { value: 'sky', label: 'Sky', color: 'blue' },
  { value: 'leaf', label: 'Leaf', color: 'green' },
  { value: 'poppy', label: 'Poppy', color: 'red' },
  { value: 'stone', label: 'Stone', color: 'grey' },
  { value: 'honey', label: 'Honey', color: 'amber' },
  { value: 'dusk', label: 'Dusk', color: 'indigo' },
  { value: 'rose', label: 'Rose', color: 'pink' },
] as const;

function SiteVisitsColour() {
  return (
    <ColorSwatchGroup aria-label="Site visits colour" name="colour" defaultValue="leaf">
      {COLOURS.map((colour) => (
        <ColorSwatch key={colour.value} {...colour} />
      ))}
    </ColorSwatchGroup>
  );
}
  • Fits: settings, record: field.
  • height, width, gap, corner, border, background, text, motion: add no class for these.

API reference

Options
OptionTypeWhat it does
valuestringThe value the group reports, and sends with its form, when this pill is chosen.
color'blue' | 'green' | 'red' | 'grey' | 'cyan' | 'amber' | 'indigo' | 'pink'The pill's colour: a hue word (blue, green, red, grey, cyan, amber, indigo, pink).
labelstringThe colour's words, which name the pill for a screen reader ("Moss"; alone, "Site colour: Moss").
variant?'default' | 'dot' = 'default'default (left out): the 20 by 10 px colour pill.
type?'button' | 'submit' | 'reset'
onClick?(event: MouseEvent) => void
disabled?boolean
Parts
PartWhat it is
ColorSwatchGroupA named row of colour pills of which one is chosen; value?: string — The chosen pill's value, for a group its caller holds (with onValueChange); defaultValue?: string — The pill chosen at first render, for a group that holds its own choice; onValueChange?: (value: string) => void — Called with a pill's value whenever a person chooses it; name?: string — The form field's name: the chosen value goes with the form it sits in (empty while none is chosen); disabled?: boolean = false — Every pill off: none takes the focus, a press or a key
  • data-slot values (to select a part by): color-swatch, color-swatch-dot, color-swatch-group

Keyboard

KeyWhat it does
TabReach the chosen pill (the first live pill when none is chosen); the row is one tab stop
ArrowRight ArrowDownMove to the next live pill and choose it, wrapping at the end
ArrowLeft ArrowUpMove to the previous live pill and choose it, wrapping at the start
Home EndMove to the first or the last live pill and choose it
Enter SpaceChoose the focused pill

Accessibility

  • The native element answers the keyboard.
  • hover, active: the browser's own (:hover, :active): write nothing

Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:

StateDrawn by
focus-visiblethe attribute data-focus-visible
checkedthe attribute aria-checked
indeterminatethe attribute aria-checked
expandedthe attribute data-state=open
openthe attribute data-state=open
disabledthe prop disabled

Motion

  • The part sets its own motion: add no transition or animation of your own.

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.

goop.so/themes/meadow/components/color-swatch.md · the page as Markdown
Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-color-swatch.json --yes

Where would you like to start?

Free · now

The Goop plugin

A design system for your AI coding agent, so screen ten matches screen one.

/plugin marketplace add goop-so/skillsthen /plugin install goop@goopCodex, Cursor, ChatGPT, the Claude app and more: Connect Goop
FreePro

The components

Every part live, with its props, its keys and what an agent sees. Whole page and app templates, working with sample data.