This project illustrates creating a customized select field that displays HTML-formatted results with integrated search functionality.
In the Model, the database column is casted to the enum.
use Filament\Support\Icons\Heroicon;use Illuminate\Database\Eloquent\Model; class Category extends Model{ protected $fillable = [ 'name', 'icon', ]; protected function casts(): array { return [ 'icon' => Heroicon::class, ]; }}
The project uses Filament's built-in Heroicon
enum class from Filament\Support\Icons\Heroicon
, which provides access to all Heroicons without needing to generate a custom enum.
We have a select field with enabled HTML support using the allowHtml()
method and search functionality using the searchable()
method.
Options for the select field are returned from the enum class.