Skip to main content

i want to make a component whose width will adjust automatically depending on the text width, but there’s an icon beside the adjustable text, and i want the icon will also automatically adjust depending on the text width. may i get a help? thank you before


Your Account Name layer is already an auto layout, but have you set the width of it to hug contents?




I tried it but it looks like this. i want to set the Account Name to fixed width so that the content inside does not exceed the Account Name width.


Hi there. I think I get you’re trying to do here — may I suggest you apply Hug contents to both the Account Name frame and the text inside, but also apply a max-width to the Account Name, so that when the text reaches the set size it’ll start wrapping inside? There may still be an extra gap between text and the icon, but it’s pretty much the best you can do I believe. I’m uploading a screenshot, I hope I understood your idea right.


You can also truncate the text if you don’t want it to wrap.


thank you it works!


Reply