pick a color,
paint the page

A color picker for React: hex, rgb, hsl and oklch, an eyedropper and full keyboard support. One shadcn item, no dependencies.

palette

Up to four colors in one row, each its own picker. The first one paints this page; make the others yours and the whole page takes them, the darkest in the shadows.

Start from a harmony

opacity

Turn on alpha and the picker gets an opacity slider, with the alpha in every format. Here it sets how much of the paint shows behind this section.

#ff6a3d80
Arrow keys move the crosshair, Enter takes the color under it.

tools

The eyedropper where the browser has one, a copy button and four formats. Click anywhere on the paint around them to take its color: that part works in every browser.

The swatch as you get it: it opens into the picker.

The same color in four formats

built for keyboards

Every part of the picker answers the keys, and a screen reader hears what changed: “Saturation 40%, Brightness 80%”, “Hue 48°”. Try it here — this panel paints the page.

Keyboard shortcuts
←→Saturation in the area by 1%, hue on its slider by 1°, opacity by 1%
↑↓Brightness in the area
ShiftWith an arrow: ten steps at once
HomeEndA slider to its ends
TabValue field, area, hue, format, eyedropper, copy, in that order
EnterSpaceOpen the picker from its swatch
EscRevert the value field, then close and return to the swatch

The swatch morphs into the panel on springs. Turn this on, or the system setting, and it simply appears.

get started

One command with the shadcn CLI, then use it like an input.

  1. Add it

    The shadcn CLI copies six files into your project: the picker, its CSS, the color math, the morph, a hook for the agent bridge and a small spring helper. No package is added.

  2. Use it

    Controlled like an input: give it any CSS color and take back a string in the format the switch shows, oklch to begin with.

    accent-field.tsx
    "use client";
    
    import { useState } from "react";
    import { ColorPicker } from "@/components/ui/color-picker/color-picker";
    
    export function AccentField() {
      const [accent, setAccent] = useState("oklch(62% 0.19 255)");
      // The swatch opens the picker; `name` sends the value with a native form.
      return (
        <ColorPicker
          color={accent}
          onChange={setAccent}
          defaultFormat="oklch"
          name="accent"
          labels={{ open: "Pick accent" }}
        />
      );
    }
  3. Need a palette?

    For a set of colors, the palette holds one to four of them, each its own picker, and brings the picker along if you skipped step 1.

questions

About the registry, oklch, the eyedropper, the palette, clipping and labels.

Why a shadcn item and not an npm package?

A color picker is something you end up restyling. The shadcn CLI copies its source into your project, so the markup, the CSS and the labels are yours to change, with nothing to keep upgrading.

What happens to oklch() colors outside sRGB?

The swatch shows them as given. The area is sRGB, so the first move of a handle keeps the lightness and hue and lowers the chroma until the color fits; the output is always one of the four formats you allow.

Where is the eyedropper in Safari and Firefox?

The button in the panel appears only where the browser has the EyeDropper API, Chromium browsers today; in Safari and Firefox it is not rendered at all, rather than shown disabled. Picking from your own image works everywhere: draw it on a canvas and read the pixel, or work it out from your own data, as the paint above does: its color comes from the frame and the ramp, not from a screenshot.

How do I let people pick more than one color?

Add the palette: one to four swatches in a row, each a full picker, with a button to add a color and Delete to remove one. It takes and gives back an array in one format, sends every color with a form under one name, and is a single Tab stop with the arrows inside.

Why is the panel cut off inside my card?

The panel is not portalled, so it keeps your theme and works inside iframes, but a container with overflow: hidden clips it. Give that container overflow: visible, or place the picker outside it. Near the viewport edges the panel flips up or left on its own.

How do I translate it or name it for screen readers?

Pass labels: every string the picker says or announces is there, from the swatch button to “Copied”. Anything you leave out keeps its English default.