asantibanez / livewire-select

Livewire component for dependant and/or searchable select inputs
MIT License
503 stars 96 forks source link

How to use this package in Bootstrap-Laravel? #33

Open desyashasyi opened 3 years ago

desyashasyi commented 3 years ago

I am wondering how to use this package in Laravel with Bootstrap?

bucari commented 2 years ago

@desyashasyi if you converted it in bootstrap can you post the changes?

IhsanDevs commented 2 years ago

@desyashasyi if you converted it in bootstrap can you post the changes?

you can custom class style to bootstrap form-select like this:

<?php

namespace App\Http\Livewire\Custom\Components;

use Asantibanez\LivewireSelect\LivewireSelect;
use Illuminate\Support\Collection;

class Tags extends LivewireSelect
{

    public function options($searchTerm = null): Collection
    {
        return collect([
            [
                'value' => 'honda',
                'description' => 'Honda',
            ],
            [
                'value' => 'mazda',
                'description' => 'Mazda',
            ],
            [
                'value' => 'tesla',
                'description' => 'Tesla',
            ],
        ]);
    }

    public function styles() // Add this method for customing class element
    {
        return [
            'default' => 'form-select w-50',
        ];
    }
}