
Summary
Full-featured color picker with two distinct layouts: Advanced (HSV square + hue/alpha sliders + eyedropper) and Grid (preset swatches). Supports multiple output formats (Hex, RGB, HSL, RGBA) and features a modern, compact UI.| Class | Bjanczak\FilamentFlexFields\Filament\Forms\Components\FlexColorPickerField |
| State type | string|null — color in the configured output format |
| FieldType | flex_color_picker |
| Playground | flex-color-picker slug in Flex Fields playground |
Basic usage
Advanced HSV Picker
Grid Palette
State & validation
Stored value
State is a CSS color string in the format selected viahex(), rgb(), hsl(), or rgba().
Validation rules (built-in)
Ensures the input is a valid color string matching the expected format.Configuration API
All methods acceptClosure unless noted.
| Method | Type | Default | Description |
|---|---|---|---|
layout(string $layout) | Setup | 'advanced' | advanced or grid |
hex() | Format | active | Set output format to Hex |
rgb() | Format | — | Set output format to RGB |
hsl() | Format | — | Set output format to HSL |
rgba() | Format | — | Set output format to RGBA |
format(string $format) | Setup | 'hex' | hex, rgb, hsl, rgba |
alpha(bool $enabled) | Setup | false | Enable opacity slider and inputs |
eyedropper(bool $enabled) | Setup | true | Show browser EyeDropper button |
gridColumns(int $cols) | Setup | 17 | Grid columns (generated palette) |
gridRows(int $rows) | Setup | 11 | Grid rows (generated palette) |
gridColors(array $colors) | Setup | null | Custom hex list for grid layout |
variant(string $variant) | Setup | 'primary' | primary, secondary, flat |
size(string $size) | Setup | 'md' | sm, md, lg |
rounding(string $rounding) | Setup | config | Border radius token |
Real-world examples
Transparent Background Color
Fixed Palette Selection
Playground
/admin/flex-fields-playground/flex-color-picker
See Playground for setup.
Related components
| Component | When to use instead |
|---|---|
| ColorSwatchField | Simple preset selection with keys |
| FlexTextInput | Standard text input for hex codes |
CSS classes (reference)
| Class | Role |
|---|---|
fff-flex-color-picker | Root wrapper |
fff-flex-color-picker__shell | Trigger + panel container |
fff-flex-color-picker__trigger | Opens picker panel |
fff-flex-color-picker__preview | Color swatch in trigger |
fff-flex-color-picker__panel | Dropdown panel |
fff-flex-color-picker__saturation | S/V square (advanced) |
fff-flex-color-picker__eyedropper | Screen color picker button |
fff-flex-color-picker__hue | Hue slider |
fff-flex-color-picker__alpha | Opacity slider track |
fff-flex-color-picker__grid | Grid swatch container |
fff-flex-color-picker__bottom-bar | Format + value + opacity inputs |