{{--
Themed text-style input (add-project.html ~line 393).
Props:
name Field name, in HTML form. Required.
label Label text.
value Fallback value; flashed old input always wins.
required Red asterisk on the label + the `required` attribute.
type Any text-style input type. Defaults to "text".
group-class Extra classes for the wrapper, e.g. "col-md-6".
Everything else — placeholder, autocomplete, min, data-* — passes straight
through to the .
---
spatie/laravel-html variant: the control is an html()->input() element and
the component's own attribute bag is merged onto it (classes additively,
everything else caller-wins) exactly as $attributes->merge() did.
--}}
@props([
'name',
'label' => null,
'value' => null,
'required' => false,
'type' => 'text',
'groupClass' => null,
])
@php
$fieldId = $attributes->get('id') ?? form_field_id($name);
$error = form_error_message($name);
$resolved = form_input_value($name, $value);
$control = html()->input($type)
->class('form-control')
->addClassIf($error !== null, 'is-invalid')
->id($fieldId)
->name($name)
->attributeIfNotNull($resolved, 'value', $resolved)
->attributeIf((bool) $required, 'required')
->attributeIf($error !== null, 'aria-invalid', 'true')
->attributeIf($error !== null, 'aria-describedby', form_field_id($name).'_error');
$passthrough = form_passthrough_attributes($attributes);
$control = $control->attributes($passthrough);
@endphp
{!! $control->render() !!}