coolify/resources/views/components/inputs/input.blade.php

38 lines
982 B
PHP
Raw Normal View History

2023-05-03 14:09:10 +02:00
@props([
'id' => null,
2023-05-04 10:00:08 +02:00
'type' => 'text',
2023-05-03 14:09:10 +02:00
'required' => false,
'label' => null,
'instantSave' => false,
'disabled' => false,
'hidden' => false,
])
2023-05-04 10:00:08 +02:00
<span @class([
'flex justify-end' => $type === 'checkbox',
'flex flex-col' => $type !== 'checkbox',
])>
2023-04-25 14:43:35 +02:00
<label for={{ $id }}>
@if ($label)
{{ $label }}
@else
{{ $id }}
@endif
@if ($required)
*
@endif
</label>
@if ($type === 'textarea')
2023-05-04 10:00:08 +02:00
<textarea {{ $attributes }} type={{ $type }} id={{ $id }} wire:model.defer={{ $id }}></textarea>
@else
2023-05-04 22:29:14 +02:00
<input wire:dirty.class="text-black bg-amber-300" {{ $attributes }} type={{ $type }}
id={{ $id }}
2023-05-04 15:45:53 +02:00
@if ($instantSave) wire:click='instantSave' wire:model.defer={{ $id }} @else wire:model.defer={{ $value ?? $id }} @endif />
@endif
2023-04-25 14:43:35 +02:00
@error($id)
<div class="text-red-500">{{ $message }}</div>
@enderror
2023-05-04 10:00:08 +02:00
</span>