@props([ 'name', // Static lists come in as a PHP iterable; lists that change on the page // (departments, once a campus is picked) come in as an Alpine expression. 'options' => null, 'optionsExpr' => null, 'selected' => '', 'placeholder' => 'Pilih', 'searchPlaceholder' => 'Cariā¦', 'emptyText' => 'Tiada padanan ditemui', // Label for an explicit "no value" entry; omit to make the field unclearable. 'emptyOption' => null, 'disabledExpr' => 'false', ]) @php $optionsJs = $optionsExpr ?: Js::from( collect($options ?? [])->map(fn ($option) => [ 'value' => (string) ($option['value'] ?? $option['id'] ?? ''), 'label' => (string) ($option['label'] ?? $option['name'] ?? ''), ])->values() ); @endphp
daripada pilihan