FilamentPHP: Allow HTML in Select (Option) Label

Published on June 20, 2024. Last updated on January 22, 2025.
FilamentPHP: Allow HTML in Select (Option) Label

By default, FilamentPHP escapes HTML in select option labels, but enabling HTML rendering is necessary for scenarios like listing category nodes.

 

To enable HTML in select option labels, add the following code to your Select component:

    ->native(false)
    ->allowHtml()

so your component should look like this:

Select::make('category_id')
    ->native(false)
    ->allowHtml()
    ->options([...])