{{-- Searchable select. Identical API to , plus the two data attributes Metronic's auto-init looks for. No JavaScript ships with this component on purpose: scripts.bundle.js (KTApp.init, run by KTComponents.init on DOMContentLoaded) already upgrades every `[data-control="select2"]` on the page, and select2 itself is inside plugins.bundle.js. Controls injected into the DOM *after* load — repeater rows, modal bodies fetched over AJAX — are not covered by that one-shot init and must be initialised by the code that inserts them. A *single* select always renders a leading empty option: select2 will not show a placeholder on one without it. A `multiple` select does not, and must not — select2 reads `data-placeholder` directly there, and the empty option would appear in the dropdown as a blank, selectable entry that posts an empty string into the field's array. Found on the CR-5 §15.3.1 Project Type multi-select, whose validator would then have rejected `[""]` with a message about a value the user never knowingly picked. --- spatie/laravel-html variant: unchanged. This component emits no markup of its own — it is a thin delegation to , whose internals were the ones ported. --}} @props([ 'name', 'label' => null, 'value' => null, 'required' => false, 'options' => [], 'placeholder' => null, 'groupClass' => null, ]) @php $resolvedPlaceholder = $placeholder ?? __('forms.select_placeholder'); // The same test x-form.select applies to decide it is an array field, so // the two components cannot disagree about what `multiple` means. $isMultiple = $attributes->has('multiple') || str_ends_with($name, '[]'); @endphp merge(['data-control' => 'select2', 'data-placeholder' => $resolvedPlaceholder]) }} />