Skip to content
ConvertFast.GitHub

OPEN SOURCE · SHADCN REGISTRY

A color picker
for shadcn/ui.

A compact React color picker that fits a shadcn project. Install the source, change the Tailwind classes, and keep the component in your codebase.

ReactTypeScriptTailwind CSSMIT
Live exampleInteractive
Brand accent

Used for buttons, links, and focus rings.

Weekly report12,480

Visitors in the last 7 days

Current value#7C3AED

01 / INSTALL

One command.
The source is yours.

The shadcn CLI adds the component, its popover and button dependencies, and react-colorful. It respects the aliases in your components.json.

Terminal
npx shadcn@latest add https://convertfa.st/r/color-picker.json

Already using ConvertFast? npx convertfast-ui@latest block add color-picker works too.

components/brand-color-field.tsxTSX
"use client"

import { useState } from "react"
import { ColorPicker } from "@/components/color-picker"

export function BrandColorField() {
  const [color, setColor] = useState("#7C3AED")

  return (
    <ColorPicker
      value={color}
      onValueChange={setColor}
      name="brandColor"
    />
  )
}

02 / USE IT

Controlled when you need it. Simple when you do not.

Pass value and onValueChange to connect the picker to application state. For a settings form, pass name and the component adds a hidden input with the current hex value.

  • Hex, shorthand hex, and eight-digit hex input
  • Optional alpha channel with showAlpha
  • Custom preset colors
  • Keyboard focus and labeled controls

03 / API

The props you will actually use.

All color values normalize to uppercase hex. Invalid typed values reset to the last valid color when the field loses focus.

PropTypeWhat it does
valuestringControlled hex color
defaultValuestringInitial uncontrolled value
onValueChange(value: string) => voidRuns when the selected color changes
showAlphabooleanAdds alpha and returns #RRGGBBAA
presetsstring[]Replaces the default preset swatches
namestringAdds a hidden form field

COMMON QUESTIONS

About this shadcn color picker.

Does shadcn/ui include a color picker?

The official component catalog does not currently include one. This component follows the same source-owned approach and composes shadcn's Button and Popover.

Can I use it without alpha?

Yes. Alpha is off by default, so the picker returns six-digit hex values. Set showAlpha when your UI needs transparency.

Can I change the design?

Yes. The registry installs a TSX file into your project. Edit its Tailwind classes, preset list, labels, or API like any other local component.

READY TO USE

Add the missing piece
to your shadcn project.

Copy the install command