function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
louisa barrett 7louisa barrett 7 

Lightning:InputField to automatically adjust height based on content

Hi All,

I have a recordEditForm on an Aura component which displays the core fields from the case object. 
My issue is I need the standard description field to automatically expand it's height to show all the content, like it does on the detail page.
Currently I get scoll bars and the ability to drag the box to expose the text.
Is it possible with a lightning:inputfield?
 
<div class="slds-grid slds-wrap">
                        <div class="slds-col slds-size_1-of-1">
                            <lightning:inputField fieldName="Description" onchange="{!c.enableButtons}"/>
                        </div>
                    </div>

 
Suraj Tripathi 47Suraj Tripathi 47
Hi Louisa Barrett,
Greetings!

You can not add CSS for inputField, it is already designed by Salesforce SLDS. 
So you can not use the Style attribute in inputField tag.

If you find your Solution then mark this as the best answer. 

Thank you!

Regards,
Suraj Tripathi
louisa barrett 7louisa barrett 7
That's what I thought. The only other way I can think to do it without losing the built in logic of the recordeditform is to wrap a formatted text field in an aura:if and copy the standard description field to that one and then show/hide it based on the save button being enabled. It's just a bit messy when all I want to do is have the field to automatically expand to the content.
Thank you for the confirmation
Suraj Tripathi 47Suraj Tripathi 47
Hi Louisa Barrett,
Greetings!

If you find your solution then close this query marking as the best answer.
It will help others, who seeking the solution for this problem.

Thank you!

Regards,
Suraj Tripathi