Text wrapping in labels

I’d like to have text wrapping as an on/off property of label (text) but I guess that’s a feature request.

In the meantime here’s a datagrid where some labels wrap in the repeating panel and some don’t.

Can anyone tell me why the labels in the ‘Organisation’ column wrap but not the 'Email’s?

1 Like

By default wrapping happens on spaces. There are no spaces in the email field, so you don’t get wrapping.

There’s CSS you can use to change that behavior, so that it wraps even if there aren’t spaces: How to Wrap a Long String Without any Whitespace Character You could put the CSS into a role and assign that role to the labels you’re having trouble with.

1 Like

You could also set the text-overflow in the role to ellipsis to get three dots when overflow happens. I usually set the tool tip for the component to the same string so you can hover over it and see it all.

From memory I think you need a fixed width for it though… :thinking:

1 Like

Doh! I should have realised it was due to the lack of whitespace. Thanks for the excellent CSS suggestion.
Thanks again for another quick answer. The Anvil forum is great. Lots of helpful folks and nobody is treated like an idiot. On some Forums I would have been lucky to get ‘CSS’ as the helpful advice.

2 Likes