Perspective Tooltip formatting?

Is it possible to format the text in a tooltip?
I want to be able to for example add line breaks and maybe bold on specific words etc.

There are some limited options with css:

1 Like

ah, I was using pre but didn’t know it needed \n :slight_smile:

edit: hmm, still not working for me…
image


(ignore the button colours… I know you can’t read the font)

Ok you posting too fast :laughing:

image

Edit 1:
image

1 Like

Now I’m very confused. Why is mine not working?? I’m in 8.1.18 and I’ve tried on multiple components, no dice. Can someone copy a basic working component and paste the JSON into here for me to try with?

This is mine:

[
  {
    "type": "ia.display.label",
    "version": 0,
    "props": {
      "text": "From Excel Table"
    },
    "meta": {
      "tooltip": {
        "enabled": true,
        "text": "asdasd\\n/nasdasd",
        "style": {
          "whiteSpace": "pre"
        }
      },
      "name": "Label"
    },
    "position": {
      "basis": "32px"
    },
    "custom": {}
  }
]

I tried both \n and /n for giggles

Ha. It’s escaping the \n!

Yep, that was it. I removed the escape character and it works now. Weird

A working example:

[
  {
    "type": "ia.display.label",
    "version": 0,
    "props": {
      "text": "Tooltip Example"
    },
    "meta": {
      "tooltip": {
        "enabled": true,
        "style": {
          "whiteSpace": "pre"
        }
      },
      "name": "Label_23"
    },
    "position": {
      "x": 0.4766,
      "y": 0.0538,
      "width": 0.0865,
      "height": 0.0331
    },
    "custom": {},
    "propConfig": {
      "meta.tooltip.text": {
        "binding": {
          "type": "expr",
          "config": {
            "expression": "'Something\\n' + 'else' + 'more\\n' + 'more\\n' + 'more\\n' + 'more\\n'"
          }
        }
      }
    }
  }
]

My version is 8.1.19

1 Like

This is my tooltip text:

"text": "Given a table of tag paths and tag properties, this function will write the tag properties to the tag paths.\\nExpects a TSV e.g. table copied from Excel with the columns:\\nTagPath\\tTagProp1\\tTagProp2\\nTag/Path\\tVal1\\tVal2",

I wonder why mine is adding the escape characters…

Once I remove them in the JSON and paste back in, it’s fine :slight_smile: thanks all
image

In my copy/paste its also added but it’s not in my binding.

Your text is a string with an escape character and mine an expression binding. It looks like it will display a string as a string even if it has an escape character. How did you got your last one to work?

That’s interesting it works as an expression…
I got my string to work by copying the button component (i.e. the component JSON), editing it in npp, and pasting it back in :confused: mildly annoying and definitely not intuitive

Yeah, manually entered text is always escaped. You have to use an expression (or enter through the view.json) if you want escape characters.