Truncating long text from Plasmic CMS on homepage

Hi, I am looking for the best way to truncate text from the Plasmic CMS. I have a field in the Plasmic CMS with long text that I’d like to show on the home page, but with a limited amount of text and then end the text with “…”. What would be the best approach to accomplish this?

Hi, do you want to clamp the text by number of lines ?

I was thinking by the number of characters, but lines could work also.

Hey, you would need to use dynamic values to get the property that you want to show, then you can set the html style attribute to:

  "display": "-webkit-inline-box",
  "WebkitBoxOrient": "vertical",
  "WebkitLineClamp": 2,
  "overflow": "hidden",
  "textOverflow": "ellipsis"

You can change the 2 there to indicate how many lines you would want, you have to be careful with this kind of usage of style attribute, this will make the controls for overflow not work anymore in your text element, you can see an example in

Captura de Tela 2024-01-15 às 12.11.59.png

Captura de Tela 2024-01-15 às 12.12.07.png