Skip to content

Color picker

ColorPicker::make($name, $label) renders a compact trigger — a color dot plus the current hex value — that opens a picker in a popover: a saturation/hue area for free colors, a swatch palette, and a hex input. The value is a lowercase hex string like #3b82f6.

ColorPicker::make('color', 'Tag color')
->placeholder('Pick a color')
->rules(['nullable', 'hex_color']);

The field ships a nine-color default palette. ->palette([...]) replaces it with your own swatches:

ColorPicker::make('color', 'Brand color')
->palette(['#0ea5e9', '#6366f1', '#f43f5e']);

Swatches preselect a color with one click; the saturation area and hex input remain available for any other color.

The submitted value is a plain string, so validate it like one — Laravel’s hex_color rule matches exactly what the picker produces:

ColorPicker::make('color', 'Tag color')->rules(['required', 'hex_color']);

ColorPicker shares label, default value, required, disabled, read-only, and visibility options with every field — see fields overview.