24 lines
961 B
PHP
24 lines
961 B
PHP
@props(['name', 'label', 'type' => 'text', 'hint' => null, 'value' => ''])
|
|
|
|
<div>
|
|
<label for="{{ $name }}" class="mb-1 block text-slate-700">{{ $label }}</label>
|
|
|
|
<input
|
|
type="{{ $type }}"
|
|
id="{{ $name }}"
|
|
name="{{ $name }}"
|
|
{{-- Passwords are never echoed back into the form. --}}
|
|
value="{{ $type === 'password' ? '' : old($name, $value) }}"
|
|
@class([
|
|
'bg-field block w-full rounded-md border px-3 py-2 text-slate-700 shadow-xs',
|
|
'transition-colors focus:outline-none focus:ring-2',
|
|
'border-red-500 focus:border-red-500 focus:ring-red-100' => $errors->has($name),
|
|
'border-slate-300 focus:border-primary-500 focus:ring-primary-100' => ! $errors->has($name),
|
|
])
|
|
>
|
|
|
|
<small @class(['mt-1 block', 'text-red-600' => $errors->has($name), 'text-slate-500' => ! $errors->has($name)])>
|
|
{{ $errors->first($name) ?: $hint }}
|
|
</small>
|
|
</div>
|