Lightning Component Height/Width Adjustment

I would like to understand if there is a way to adjust the height of the lightning Component.

Went through the following articles and developer forum threads:

Want to change the height of the home page component dynamically

but no of much help.

Can anyone please assist me here?

Thanks!

Answer

One way is to bind an attribute to an inline stylesheet

<aura:attribute name="divHeight" type="Integer" default="100" />

<div onclick="{!c.changeHeight}" style="{! 'height:'+v.divHeight+'px;'}"></div> 

Then in your controller method you can change the height of the div

changeHeight: function(component, event, helper) {
  component.set("v.divHeight", "300");
}

Attribution
Source : Link , Question Author : Salesforce Developer , Answer Author : Scott Morrison

Leave a Comment