Can text push a rectangle in size?

Hi,
is it possible to define an textarea/rectangle which is defined by its inner text?

For example an menu item with an border on the bottom: by writing the inner menu-text, the text will never wrap but defining the size of the box in width (and also extends the lower border).

Some tipps appreciated (keywords will help, no need for a complete tutorial :wink:

Thanks!

Hey, this is certainly possible, but we’d love to take a look at your current setup so we can provide a solution based on your current workflow!

Using the sizing options you can:

  • Set the width of the text element to Fit

This will make it so the text element itself increases in Width whenever the inner text is bigger than the element itself.

You can also combine this with a rectangle, which is set to Fill Width (within a Stack) and the Fit Height (so it only grows horizontally). Let us know if this sample file we have attached works!

forum-sample-stack.sketch (5.2 KB)

Thanks a lot! Adding Layout / adding a Stack are the keys. Even with paddings.

I really don’t know how you guys are doing all this, but Sketch is always suprising me in a positive way and always like “that’s how I would do it, and exactly what I’ve been looking for.” great support, great tools, great forum - and it looks all great (design), even your website.

I’m german, and usually I’m sparing with praising :sweat_smile:

again, thank you very much.

2 Likes