-
-
Notifications
You must be signed in to change notification settings - Fork 86
Radio
tanthammar edited this page Sep 25, 2020
·
8 revisions
Extends BaseField
- Flat key => value based Array.
- You can use a component method that returns an array; ->options($this->someMethod())
- The callable should return a flat key => value array.
- OBSERVE: that this call will be executed on EVERY re-render of the component!
- Maybe you should consider using the options() method and set the property in mount() instead
/**
* Radio, associative array
*/
$options = ['Wifi' => 'wf', 'Bluetooth' => 'bl', 'Ethernet' => 'eth'];
return Radio::make('Radio')
->options($options)
->rules([Rule::in(array_values($options))])
->default('wf');
/**
* Radio where labels = key
*/
$options = ['Wifi', 'Bluetooth', 'Ethernet'];
return Radio::make('Radio')
->options($options)
->rules([Rule::in($options)])
->default('Wifi');
@foreach($field->options as $value => $label)
<x-tall-radio
:field="$field"
:temp-key="$temp_key"
:value="$value"
:label="$label"
:options-idx="$field->name.$loop->index" />
@endforeach
Extend Blade component (or override in config file)
Tanthammar\TallForms\Components\Radio::class
- Installation
- Requirements
- v5 Upgrade Guide
- v6 Upgrade Guide
- v7 Upgrade Guide
- Support
- Quickstart
- Manual installation
- Optional
- Form component
- Field
- Field types
- Example Form
- Blade Components
- Notifications