Radio

Default attributes

By default, it will look up for:

  • $object->id for option value.
  • $object->name for option display label.

@php
$users = App\Models\User::take(3)->get();
@endphp
 
<x-radio label="Select one" :options="$users" wire:model="selectedUser" />

Alternative attributes

Just set option-value and option-label representing the desired targets.

Choose wisely
@php
$users = App\Models\User::take(3)->get();
@endphp
 
<x-radio
label="Select one"
:options="$users"
option-value="custom_key"
option-label="other_name"
wire:model="selectedUser2"
hint="Choose wisely"
class="bg-red-50" />

maryUI
Sponsor