FilamentF
Filament2y ago
Vp

textinput prefix with select dropdown

I am trying to create like image, but I stuck at few points. I can achieve only design like below
Forms\Components\TextInput::make('mobile')
    ->prefix(
        new HtmlString(Blade::render('
            <x-filament::input.select wire:model="status">
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">4</option>
            </x-filament::input.select>
        '))
    ),

But there are two (or more maybe) problems comes:
  1. How can I pass variable and loop through select options
  2. How can I have these data (selected) for store/edit etc
How can I make it work for these points, or any other alternative ways to achieve the same
Screenshot_from_2024-03-27_11-53-35.png
Solution
I end up doing closure, need to return HtmlString
->prefix(function () {
    return new HtmlString(view('phone-input'));
})
Was this page helpful?