+ Start a Discussion
Sid LightningSid Lightning 

Lookup icon for Lightning input field in lightning component ?


I need to get the lookup icon in Lightning input field. Can anyone please help .

Currently , I am getting a free text area . I have to lookup to user object
Harsh P.Harsh P.
Hi sid,

Hope below code will help you.
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" >

  <aura:attribute name="oppty" 
                    default="{ 'sobjectType': 'Opportunity'}"/>
    <div class="slds-box slds-theme_default">
        Account : <force:inputField value="{!v.oppty.OwnerId}"/>

Harsh p.
Khan AnasKhan Anas (Salesforce Developers) 
Hi Sid,

Greetings to you!

It seems like this is a bug but it is not listed in known issues as of now. There are other known issues as well related to lightning:inputfield lookup.



Please refer to the below links which might help you further.



I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Ajay K DubediAjay K Dubedi
Hi Sid ,
Please try the below code and let me know if this works for you. If still need modifications do let me know.
<aura:component implements="flexipage:availableForAllPageTypes">
    <div class="slds-form-element">
        <label class="slds-form-element__label" for="text-input-id-1">Input Label</label>
        <div class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right">
            <lightning:icon class="slds-icon slds-input__icon slds-input__icon_left slds-icon-text-default" iconName="utility:search" size="x-small" alternativeText="Search address"/>
            <lightning:input  value="" />

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Ajay Dubedi