Building a custom color palette field in Filament - Part 1 To accept an array of options on the field, we need to declare a new method on the class.

protected array $options = []; public function options(array $options): static { $this->options = $options; return $this; }}

Let's add a getOptions() method to the field that returns the array of options given to the field.

In it's current state, the ColorPalette field can only accept a static array of color options.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners