HSV picker with sliders, format readouts, hex input, presets, popover mode, and eyedropper.
npx shadcn@latest add @iconiq/color-picker"use client";
import { useState } from "react";
import { ColorPicker } from "@/components/ui/color-picker";
export function BrandColorPicker() {
const [color, setColor] = useState("#3B82F6");
return (
<div className="flex w-full items-center justify-center px-4 py-6">
<div className="flex w-full flex-col items-center gap-4 text-center">
<ColorPicker
aria-label="Brand color"
name="brand-color"
onChange={setColor}
showCopy
value={color}
/>
<p className="flex flex-wrap items-center justify-center gap-x-1 gap-y-1 text-balance text-center text-[15px] text-muted-foreground leading-relaxed sm:text-base">
<span>Your</span>
<span className="font-medium" style={{ color }}>
brand color
</span>
<span>—tuned from one compact panel.</span>
</p>
</div>
</div>
);
}valueControlled hex color such as #3B82F6 or #3B82F680. When provided, the picker syncs its internal state to this value.
Type string
defaultValueStarting color for uncontrolled usage (3-, 6-, or 8-digit hex). Ignored when value is supplied.
Type string·Default #3B82F6
onChangeCalled when the color settles (pointer up on sliders, blur/Enter on inputs). Emits #RRGGBB, or #RRGGBBAA when alpha is below 100%, plus CSS strings in detail.
Type (color: string, detail: ColorPickerChangeDetail) => void
onValueCommitFires alongside onChange when the color settles. Useful for form commit handlers.
Type (color: string, detail: ColorPickerChangeDetail) => void
defaultAlphaStarting alpha percentage (0–100) for uncontrolled usage when defaultValue has no alpha channel.
Type number·Default 100
defaultFormatInitial readout format for the footer row.
Type "HEX" | "RGB" | "HSL" | "OKLCH"·Default HEX
variantInline panel (default), field popover trigger, or compact swatch trigger that opens the picker on click.
Type "inline" | "popover" | "swatch"·Default inline
openControlled open state when variant is popover.
Type boolean
defaultOpenInitial open state for uncontrolled popover usage.
Type boolean·Default false
onOpenChangeCalled when the popover panel opens or closes.
Type (open: boolean) => void
placeholderPlaceholder text for the popover trigger label.
Type string·Default Pick a color
presetsQuick-select swatch colors shown above the saturation field.
Type string[]
swatchShapeCorner style for swatch triggers and preset chips. Use circle for a fully round swatch.
Type "default" | "circle"·Default default
showAlphaShows or hides alpha controls and keeps output opaque when false.
Type boolean·Default true
showCopyShows a copy-to-clipboard control for the active format string.
Type boolean·Default false
disabledDisables picker interaction and lowers shell opacity.
Type boolean·Default false
showEyedropperShows or hides the pipette control in the footer row.
Type boolean·Default true
onEyedropperUnsupportedCalled when EyeDropper is unavailable. No alert dialog is shown by default.
Type () => void
idRoot element id used for internal aria wiring.
Type string
nameHidden input name for native form submission.
Type string
aria-labelAccessible label when not using aria-labelledby.
Type string·Default Color picker
aria-labelledbyID of an external label element.
Type string
classNameMerged onto the outer shell for width, shadow, or layout overrides.
Type string
Install the exact registry entry shown on the right when you want the component file and its declared runtime dependencies together.
Dependencies: @base-ui/react, lucide-react, motion.
This page documents the Base UI install only. Text inputs use the Base UI Input primitive; Radix UI does not ship a dedicated color picker primitive.
The generated registry file is /r/color-picker.json.
Contact
Additionally, if you find any bug or issue, feel free to raise an issue.