Requirement: I have a simple input form (LWC) where our customers can enter necessary details and submit it our approvals team. We have an input field where we are pre-populating it with the data coming from our internal API. Now that it's an input field, we are giving an opportunity to 'edit' its value prior to submission.
Issue:
Now, as we are getting the data from API, there is a delay in rendering the data onto this field, so we are trying to implement a small lightning-spinner
next to the input box so our customers can see some processing and data is being retrieved. But, my implementation making the spinner to hide the entire form.
LWC.html
<div class="slds-col slds-size_3-of-12">
<abbr title="required" class="slds-required">*</abbr>
<label class="fld-label">National Data: </label>
<lightning-input type="text" name="National_Data" variant="label-hidden" value={nationalData} data-id="nationalDataRate" data-target-id="nationalData" minlength="1" maxlength="2" onchange={handleChange} onblur={handleOnBlur} message-when-value-missing="Enter data."></lightning-input>
</div>
<div class="slds-col slds-size_1-of-12" style="padding-left: 0px;padding-top: 26px;">
<template if:false={isLoaded}>
<lightning-spinner alternative-text="Loading" size="small"></lightning-spinner>
</template>
<template if:true={isLoaded}>
<span>$$</span>
</template>
</div>
LWC.js
isLoaded = false;
//Webservice callout
//Once the data is available, setting back the value to 'true'
this.isLoaded = !this.isLoaded;
Question: How to achieve the spinner to spin right next to the input field box, but not on the entire form?