Update 03-select.md

This commit is contained in:
Dan Harrin
2024-02-10 10:19:36 +00:00
committed by GitHub
parent cd07c1a9d0
commit 6f63e5f6af
@@ -367,28 +367,6 @@ MorphToSelect::make('commentable')
])
```
#### Allowing select to be non-native
You may enable a more customizable JavaScript select using the `native(false)` method:
```php
use Filament\Forms\Components\MorphToSelect;
use Illuminate\Database\Eloquent\Builder;
MorphToSelect::make('commentable')
->native(false)
->types([
MorphToSelect\Type::make(Product::class)
->titleAttribute('name')
->modifyOptionsQueryUsing(fn (Builder $query) => $query->whereBelongsTo($this->team)),
MorphToSelect\Type::make(Post::class)
->titleAttribute('title')
->modifyOptionsQueryUsing(fn (Builder $query) => $query->whereBelongsTo($this->team)),
])
```
> Many of the same options in the select field are available for `MorphToSelect`, including `searchable()`, `preload()`, `allowHtml()`, and `optionsLimit()`.
## Allowing HTML in the option labels
By default, Filament will escape any HTML in the option labels. If you'd like to allow HTML, you can use the `allowHtml()` method: