Expand text with "show more" -- what am I missing?

Hello - in a repeating group I want to show each entry’s descriptive text as a snippet with a “show more” icon so the user can expand the text to its full length. Each entry’s descriptive text can vary substantially, from a sentence to multiple paragraphs.

Are my only two options here:
a) Create two text elements – one for the snippet text (using the “cut off content if the element is not tall enough…” option), and one for the full text, and then show/hide the elements based on whether I’m showing the short or full version
b) Create a condition on the text element where the text source changes and use the :truncate function to have a short vs. full version.

I’m asking because neither of these options allow you to create a snippet that has a consistent min/max height. So if I want my snippet to be tall enough for 5 lines, but shorter if the full text is less than that, the above approaches don’t work.

Am I missing any options here? Thank you.

Hey there @ed727,

Maybe force the user to have at least 5 lines worth?

Thanks @johnny for taking a look. We input the descriptions on our side, and unfortunately the nature of them is that they can be long or short.

I ended up going with “b”, using the truncate function. With “a” I tested it and Bubble didn’t always put the “…” at cut off text (depended on whether it was cutting at a blank line). “b” was a little more work to set up because you have to do a character count of each description to determine whether it’s getting truncated and needs the “…” and a “more” button. But it seems to be working well and I can live with the varying height.

This topic was automatically closed after 70 days. New replies are no longer allowed.