{{-- A select: the native ``. The field's root carries `data-md-select`; what a select changes in the field's chrome is resources/css/components/select.css. --}} @props([ 'label' => null, 'hint' => null, 'hintClass' => null, 'icon' => null, 'options' => [], 'optionValue' => 'id', 'optionLabel' => 'name', 'placeholder' => null, 'placeholderValue' => null, 'size' => 'md', 'variant' => null, ]) @php $model = $attributes->whereStartsWith('wire:model')->first(); $id = $attributes->get('id') ?? 'field-'.substr(md5($model.'|'.$label.'|select'), 0, 12); // A plain form's field is named, not bound: its errors are under its name (`files[]` → `files`, `a[b]` → `a.b`). $errorKey = $model ?? (filled($attributes->get('name')) ? str_replace(['[]', '[', ']'], ['', '.', ''], (string) $attributes->get('name')) : null); $messages = $errorKey !== null && isset($errors) ? \Illuminate\Support\Arr::flatten($errors->get($errorKey)) : []; $fieldIconSize = ['sm' => 20, 'xs' => 16][$size] ?? 24; @endphp