Is it possible to combine a text field with a shape in Sketch whereby the shape will auto expand to accommodate the text length?
3 Answers
Sketch doesn't have this functionality built-in by default, but there are two very similar plug-ins that offer it:
I've been using Dynamic button for quite a while, but recently switched to Compo, as it offers greater control in setting margins (e.g. it's possible to keep an element fixed to a certain side of a component).
-
FWIW I just tried both of those plugins on symbols in Sketch 50.2 with no luck. They might work on non-symbols, but that defeats the purpose for me as I want to be able to do things like update the design of a variable height list item from one place.– WestonJun 19, 2018 at 17:53
-
@Weston Yes, they only work on non-symbols. I don't know of a way to use symbols for this.– Tin ManJun 19, 2018 at 19:53
A plugin that's definitely working for symbols in Sketch 50.2 is Paddy. By creating a specially named layer, the plugin will auto-resize it every time the "contents" are resized.
A newer version is being developed that is much more powerful, too
Aside from plugins, the only workaround would be to duplicate the text layer, convert one of them to outlines and hide the other.
This way you still have a backup to change text if you really need to. The outlines will scale, but the hidden text won't.