@props([
'id' => null,
'label' => null,
'icon' => null,
'hint' => null,
'hintClass' => 'label-text-alt text-gray-400 ps-1 mt-2',
'placeholder' => null,
'optionValue' => 'id',
'optionLabel' => 'name',
'options' => array(),
'prepend' => null,
'append' => null,
'errorField' => null,
'errorClass' => 'text-red-500 label-text-alt p-1',
'omitError' => false,
'firstErrorOnly' => false,
])
@php
$modelName = $attributes->whereStartsWith('wire:model')->first();
$errorFieldName = $errorField ?? $modelName;
$id = $id == $modelName ? $modelName : "{$id}{$modelName}";
@endphp
{{-- STANDARD LABEL --}}
@if($label)
@endif
{{-- PREPEND/APPEND CONTAINER --}}
@if($prepend || $append)
@endif
{{-- PREPEND --}}
@if($prepend)
{{ $prepend }}
@endif
{{-- ICON --}}
@if($icon)
@endif
{{-- APPEND --}}
@if($append)
{{ $append }}
@endif
{{-- END: APPEND/PREPEND CONTAINER --}}
@if($prepend || $append)
@endif
{{-- ERROR --}}
@if(!$omitError && $errors->has($errorFieldName))
@foreach($errors->get($errorFieldName) as $message)
@foreach(Arr::wrap($message) as $line)
{{ $line }}
@break($firstErrorOnly)
@endforeach
@break($firstErrorOnly)
@endforeach
@endif
{{-- HINT --}}
@if($hint)
{{ $hint }}
@endif