Select & Multiselect

$options = ['Wifi' => 'wf', 'Bluetooth' => 'bl', 'Ethernet' => 'eth'];
$options = ['Wifi', 'Bluetooth', 'Ethernet'];Select
Select::make('Select')
->options($options)
->default('wf')
->fieldWidth('w-full sm:max-w-sm')
->wire('defer')// if you don't want a network request on every selection
->rules(['nullable', Rule::in(array_values($options))]);Multiselect
MultiSelect::make('Multi Select')
->options($options)
->default(['wf'])
->deferEntangle(false)//remove if you want the field to be deferred
->fieldWidth('w-full sm:max-w-sm')
->wire('defer')// if you don't want a network request on every selection
->rules(['nullable', Rule::in(collect($options)->values()->implode(','))]);Methods
->options($options)
->placeholder(string $placeholder)
Last updated
Was this helpful?