Does it makes sence to use @include for components like inputs or buttons?
For example, I am using Material Web Components, and this is how my input field looks like (as a component):
@php
if(!isset($id)) {
$id = generateRandomString();
}
@endphp
<div class="mdc-text-field mdc-text-field--outlined w-100">
<input type="{{ $type ?: 'text' }}" name="{{ $name }}" id="{{ $id }}" class="mdc-text-field__input" {{ isset($required) ? 'required' : null }}>
<div class="mdc-notched-outline">
<div class="mdc-notched-outline__leading"></div>
<div class="mdc-notched-outline__notch">
<label for="{{ $id }}" class="mdc-floating-label">{{ $label }}</label>
</div>
<div class="mdc-notched-outline__trailing"></div>
</div>
</div>
@if(isset($helperMessage))
<div v-if="" class="mdc-text-field-helper-line">
<p class="mdc-text-field-helper-text mdc-text-field-helper-text--persistent">{{ $helperMessage }}</p>
</div>
@endif
Now, every time I want to use the input, I use @include to reference it:
@include('textfield', ['name' => 'email', 'type' => 'email', 'label' => 'label', 'helperMessage' => $errors->first('email'), 'required' => '1'])
But does this affect performance, since there can be multiple inputs on one page? I am using the same approach for Vue, but since vue is client side, that doen't effect the initial loading time.
Thanks for your Advide!