© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
1 reply
adnn

different getOptionLabelFromRecordUsing for selected items?

     Forms\Components\Select::make('website')
                                    ->live()
                                    ->label('Brand')
                                    // ->required()

                                    ->multiple()
                                    ->relationship('website', 'name')
                                    ->allowHtml()
                                    ->getOptionLabelFromRecordUsing(fn (Website $record) =>
                                    "<span class='font-semibold text-md'>{$record->name}</span> <br/>
                                    <span class='text-xs font-light'>{$record->id}&nbsp;{$record->domain}</span>"

                                    )

                                    ->searchable(['name', 'domain'])
                                    ->preload(),
     Forms\Components\Select::make('website')
                                    ->live()
                                    ->label('Brand')
                                    // ->required()

                                    ->multiple()
                                    ->relationship('website', 'name')
                                    ->allowHtml()
                                    ->getOptionLabelFromRecordUsing(fn (Website $record) =>
                                    "<span class='font-semibold text-md'>{$record->name}</span> <br/>
                                    <span class='text-xs font-light'>{$record->id}&nbsp;{$record->domain}</span>"

                                    )

                                    ->searchable(['name', 'domain'])
                                    ->preload(),


Is it possible to have different html for the currently selected item? For example to only show the name on the Selected item, but show other things when searching items
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

SelectFilter->getOptionLabelFromRecordUsing
FilamentFFilament / ❓┊help
13mo ago
getOptionLabelFromRecordUsing GetRelation
FilamentFFilament / ❓┊help
3y ago
Items remain selected when filtered
FilamentFFilament / ❓┊help
3y ago
Sum of items selected on table?
FilamentFFilament / ❓┊help
2y ago