@props([
    'label' => '',
    'name' => '',
    'placeholder' => '',
    'type' => 'text',
    'disabled' => false,
    'required' => false,
    'class' => '',
])

<div class="mb-3">
    @if($label)
        <label class="form-label">
            {{ $label }}
            @if($required)
                <span class="text-danger">*</span>
            @endif
        </label>
    @endif

    <input
            type="{{ $type }}"
            placeholder="{{ $placeholder ?: $label ?: '' }}"
            id="{{ $name }}"
            wire:model.live="{{ $name }}"
            @disabled($disabled)
            @required($required)
            {{ $attributes->merge([
                'class' => "form-control $class " . ($errors->has($name) ? 'is-invalid' : '')
            ]) }}
    >

    @error($name)
    <div class="invalid-feedback">
        {{ $message }}
    </div>
    @enderror
</div>
