#Expand RichTextLabel in both directions

1 messages · Page 1 of 1 (latest)

graceful salmon
#

Is it possible to arrange nodes in such a way that a RichTextLabel would expand both horizontally and vertically? Essentially I'd like to create kinda like chat bubbles that match the text length horizontally when they have just a single line but then expand vertically when they have multiple lines.

I could definitely do it by code but I'd prefer to use the correct container nodes to achieve this if it is possible.

spiral lantern
#

it depends on what you call "multiple lines"

#

if you mean multiple lines literally, all separated with a carriage return, then yes you can achieve this quite simply

#

if you rather mean that you have a min width and a max width for your label, and if the text is larger that the max width, you want to wrap text so that is expands vertically, then no there is no simple way of achieving that before as far as I know

#

you can do autowrap (for a fixed width)

#

you can do horizontal size adaptation (without autowrap)

#

but the combination of both requires to take a dive in the code

graceful salmon
#

I'd like to indeed achieve this without manually placing carriage returns.

#

I also asked this on the forum, where someone did say it should be possible. However, I was unable to follow their instructions 🤔