rawilk / laravel-form-components

Form components built for Tailwind & Livewire.
https://randallwilk.dev/docs/laravel-form-components
MIT License
394 stars 44 forks source link

Support simple array options in x-select #89

Closed rawilk closed 1 year ago

rawilk commented 1 year ago

In the x-select component, simple array options are not being mapped correctly and causing errors to be thrown.

<x-select 
    :options="[
        'option_1',
        'option_2',
    ]"
/>

This will cause the select to mistake them as "opt groups", and inside the @foreach loop on the option, it will throw an error because it will try to iterate over a string instead of an array.

This PR will normalize the options the same way that x-custom-select does, and will fix this issue. The x-select component will no longer try to render them as opt groups.

rawilk commented 1 year ago

This PR will close #88