{{-- One choice from a few, each with room for a line of explanation: M3's radio buttons. A `
` whose legend is the question, so a screen reader reads the group's name with each option, and native radios sharing a name, so the arrow keys move between them. `options` as `['id' => …, 'name' => …, 'hint' => …]` (`'disabled' => true` greys one out), `option-value`, `option-label` and `option-hint` to read other keys, `inline` to lay them in a row from `sm`, and `value` for the option chosen when the page loads (with `wire:model`, Livewire sets it). Errors are read from the bag under the `wire:model` name (resources/css/components/selection.css). --}} @props([ 'label' => null, 'hint' => null, 'options' => [], 'optionValue' => 'id', 'optionLabel' => 'name', 'optionHint' => 'hint', 'inline' => false, 'value' => null, ]) @php $model = $attributes->whereStartsWith('wire:model')->first(); $name = $attributes->get('name') ?? $model ?? 'radio-'.substr(md5($label.'|'.json_encode($options)), 0, 12); $id = 'radio-'.substr(md5($name.'|'.$label), 0, 12); $messages = $model !== null && isset($errors) ? \Illuminate\Support\Arr::flatten($errors->get($model)) : []; @endphp
only(['class', 'wire:key'])->class(['min-w-0']) }} @if ($messages !== [] || filled($hint)) aria-describedby="{{ $id }}-support" @endif > @if (filled($label)) {{ $label }} @endif
$inline])> @foreach ($options as $option) @php($optionHintText = data_get($option, $optionHint)) @endforeach
@if ($messages !== []) @elseif (filled($hint))

{{ $hint }}

@endif