Checkboxes
Last updated
Was this helpful?
Last updated
Was this helpful?
$options = ['Wifi', 'Bluetooth', 'Ethernet'];
Checkboxes::make('Checkboxes')
->options($options)
->rules(['array', Rule::in($options)])
->default(['Wifi']);
}
$options = ['Wifi' => 'wf', 'Bluetooth' => 'bl', 'Ethernet' => 'eth'];
Checkboxes::make('Checkboxes')
->options($options)
->rules(['array', Rule::in(array_values($options))])
->default(['wf']);
}
This field is an Alpine component to prevent lagging from user input
Entangle is deferred by default, add this if you want to send a network request on every user selection. You can also use xmodel(...)
A list or flat key => value
based Array
, Collection
or Closure
.
OBSERVE: if you use a callable, it will be executed on EVERY re-render of the component! Maybe you should consider setting the $options
in mount(
) instead?
You can use a component method that returns an array;
options($this->someMethod())
//Livewire properties example
public array $checkboxes = ['value1'];
public array $checkboxOptions = [ 'value1' => 'Label 1', 'value2' => 'Label 2' ];
<x-tall-checkboxes
:field="Checkboxes::blade('checkboxes')->options($checkboxOptions)"
/>
Search for Checkbox
in tall-theme.css