auditionadmin/resources/views/components/form/checkbox.blade.php

33 lines
1009 B
PHP

@props(['name',
'label' => false,
'description' => '',
'checked' => false,
'id' => false,
'value' => 1,
])
@php
if(! $id):
$id = $name;
endif;
@endphp
<div class="relative flex items-start">
<div class="flex h-6 items-center">
<input id="{{ $id }}"
aria-describedby="comments-description"
name="{{ $name }}"
type="checkbox"
value="{{ $value }}"
@if($checked) checked @endif
{{ $attributes->merge(['class' => "h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-600"]) }}>
</div>
<div class="ml-3 text-sm leading-6">
@if($label)
<label for="{{ $id }}" class="font-medium text-gray-900">{{ $label }}</label>
<p id="comments-description" class="text-gray-500">{{ $description }}</p>
@endif
@error($name)
<p class="text-xs text-red-500 font-semibold mt-1 ml-3">{{ $message }}</p>
@enderror
</div>
</div>