View more for a Comment text with more than 200 characters

0
Hello everyone! I am looking for the best way to do this: I want to truncate a comment if is has more than 200 characters. If this condition is I want to have a button to "View more" and it will let the user view the full text of the comment.  
asked
1 answers
0

Maybe use two text fields and switch between the two by setting their visibility.

One text area widget with 2 lines and one with more lines that is shown when the user presses the button 'show more'.

Another option could be to place a text area of larger size in a form with the same entity and open this as a dialog when pressing the button.

A third option could be to change the text with css where a class shortens the text to the max of 200 chars (like is shown here: https://benmarshall.me/css-limit-text-length/) and another class that shows the complete text. This can be changed by the dynamic class property and controlled by the show more button that influences the boolean statement of the dynamic class property to show the desired result by setting the class.

Hopefully these ideas will help you in designing this requirement.

answered