How to make a auto-height textinput component for Power Apps
Some controls in Power Apps do not have an auto height property, which means that we can’t get the Height of a control to automagically adjust to its content. Especially for the textinput control, this is a real bummer, as we a user’s input a pretty much unpredictable. On the one hand, we do not want to waste precious screen estate by making the box as big as possible, on the other hand, a too small box will result in an ugly scrollbar that no one want to see.

Build a component with me
If you follow my blog posts then you might know that I love to componentize everything that I’d like to use again, and an auto-height textinput seems to tick that box as well.
- Open make.powerapps.com
- Create a new component
cmp_textinput - Create a custom input property outsideMargin (Number),
20- determines the margin around the component - Create a custom output property userText (Text),
txt_userInput.Textso that we can pass this value back to our app
Make magic work
- Insert a text label
lbl_autoHeightHelperand a textinputtxt_userInput - Make sure that the textinput sits on top
- Set the Mode of the textinput to
Multiline - Set the X and Y of the textinput to
cmp_textinput.outsideMargin - Set the Width of the textinput to
cmp_textinput.Width-2*cmp_textinput.outsideMargin- this makes sure, that when you horizontally resize the component, this also applies to the textinput as well - Set Height of the textinput to
Max(42, lbl_autoHeightHelper.Height) - Set the Text of the text label to
txt_userInput1.Text - Set X of the text label to
txt_userInput1.Xand Y totxt_userInput1.Y - Set Width of the text label to
txt_userInput1.Width - Set the Height of the text label to
cmp_textinput.Height-2*cmp_textinput.outsideMargin - Set the auto height of the text label to
true - Set the Color of the text label to
Transparent - For the text label, set Font to
txt_userinput.Font, FontWeight totxt_userinput.FontWeight, and Size totxt_userinput.Size - Set the Width of the textlabel to
txt_userInput.Widthand the Height toMax(42, lbl_autoHeightHelper.Height)
Understand the magic
- We utilize the auto height property of the text label and hook it to the Height property of the text input. The text label will get exactly the text in the Font, Size, FontWeight of the textinput, but as we set the Color to
Transparent, it won’t show up. - For the Width of the text input, we reference the width of the component itself so that we can make the textinput as wide as necessary by adjusting the size of the component instance in an app
- The
Max(42, lbl_autoHeightHelper.Height)for the Height of the textinput ensures that we always have 42 as a minimum Height and the Height of the text label (which has auto height enabled) as maximum Height
Feedback and what’s next
That’s it!
a little hack to bring auto-height to controls that don’t come with it out of the box. Let me know what you think on twitter.
Maybe you could spot in the screenshot above, that I added some more cool features to my component, such as a trailing icon (delete, error), a label, an asterisk. a helper and an error text, and an indicator of how many characters are still left. This is a sweet sneak preview on a Material design component library that I am building together with my dear friend and partner in crime Robin Rosengrün.
If you want to know more about it and/or you found this blog post useful, please also subscribe to my newsletter - news coming about every 2 months, I promise to not spam you!
Published on:
Learn moreRelated posts
Top 25 Real-World Power Apps Projects Every Fresher Should Build Before Applying for Jobs
Introduction One of the biggest mistakes fresh graduates make while preparing for Microsoft Power Platform Developer interviews is focusing on...
Offline-First Canvas Apps Grow Up: Real-Time Dataverse Access Arrives
A field technician I shadowed on a project once put it perfectly: "The app works great in the parking lot and dies in the basement — and...
Did You Know | Power Apps Code Apps have a new CLI (power-apps) that replaces ‘pac code’
If you have been building Power Apps Code Apps with the pac code commands, there is a new CLI you should know about. The power-apps npm CLI is...
Power Apps Code Apps | power-apps authorization error | Reason and fix
In my previous post, Power Apps Code Apps – Trigger a Power Automate Flow, I walked through adding and calling a cloud flow from a code a...
How to Backup a Microsoft Power Pages (Power Apps Portals) Website
Microsoft Power Pages (formerly known as Power Apps Portals) is a low-code platform for building secure, external-facing websites that integra...
Power Apps – Entity scoping in global search
We are announcing entity scoping in global search in Power Apps. This feature will reach public preview on August 7, 2026. How does this affec...
Power Apps – Multi Select in Grid column filtering
We are announcing Multi Select in Grid column filtering in Power Apps. This feature will reach public preview on August 7, 2026. How does this...
Benefits of Microsoft Power Apps for Modern Businesses: Why Businesses Are Embracing Low-Code Development
Every business wants to work smarter, respond faster, and reduce manual effort. Yet many organizations still rely on spreadsheets, paper forms...