FilamentF
Filament2y ago
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(),


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
Was this page helpful?