New line in matrix label send from custom module

I'm trying to create a line break in a string send from a custom module to a matrix widget (button widget).

receive(
            "/EDIT",
            "pingstatus/" + i,
            {"label": `the location is \n ${item.locatie}`, "colorWidget": item.status}
          );

The \n is not working in this example. In the log file I see that an addition backslash is added in the. Any idea?

Debugger

(DEBUG, OSC) In:  {
  address: '/EDIT',
  args: [
    'pingstatus/0',
    '{"label":"the location is \\n Onder de bank","colorWidget":"green"}'
  ]
} From: undefined:undefined 

Have you tried using an html break tag (<br>) instead of a line feed? Just a guess, @erietman, sorry I'm not in a position to test it out right now.

1 Like

Hi,

thanks voor your suggestion. I've already tried that but. no luck...:frowning:

I tested your code on a minimal session and it works as expected, are you using some custom css that might conflict with line breaks (such as css' white-space property) ?

Hi,

Just checked it. It was indeed a conflict with the css 'white-space' property. It's all working now.

Thanks!