coolify/resources/views/components/forms/checkbox.blade.php

40 lines
1.2 KiB
PHP
Raw Normal View History

2024-09-02 19:54:21 +00:00
@props([
'id',
'label' => null,
'helper' => null,
'disabled' => false,
'instantSave' => false,
'value' => null,
2024-11-15 20:44:02 +00:00
'checked' => false,
2024-09-02 19:54:21 +00:00
'hideLabel' => false,
'fullWidth' => false,
2024-09-02 19:54:21 +00:00
])
<div @class([
'flex flex-row items-center gap-4 pr-2 py-1 form-control min-w-fit dark:hover:bg-coolgray-100',
'w-full' => $fullWidth,
])>
@if (!$hideLabel)
2024-11-15 20:44:02 +00:00
<label @class([
'flex gap-4 items-center px-0 min-w-fit label w-full cursor-pointer',
])>
<span class="flex flex-grow gap-2">
@if ($label)
{!! $label !!}
@else
{{ $id }}
@endif
@if ($helper)
<x-helper :helper="$helper" />
@endif
</span>
@endif
2024-11-15 20:44:02 +00:00
<input @disabled($disabled) type="checkbox" {{ $attributes->merge(['class' => $defaultClass]) }}
@if ($instantSave) wire:loading.attr="disabled" wire:click='{{ $instantSave === 'instantSave' || $instantSave == '1' ? 'instantSave' : $instantSave }}'
@if ($checked) checked @endif
wire:model={{ $id }} @else wire:model={{ $value ?? $id }} @endif />
@if (!$hideLabel)
</label>
2024-09-02 19:54:21 +00:00
@endif
2023-06-14 11:07:58 +00:00
</div>