I have two lightning:button and a lightning:input field. What I have seen in some places is that. Some buttons are enabled only when values are entered in the text boxes. Is this achievable in lightning

1 Answer 1


We use the disabled attribute of the ui:button || lightning:button components. Here is an example.


  <aura:attribute name="username" type="String" default="" />

  <ui:inputText required="true" value="{!v.username}" label="Username" updateOn="keyup" />
  <ui:button disabled="{!empty(v.username)}" class="slds-button_brand" label="Submit" />


PS: I have used the ui:* components here you can use the lightning:* components.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.