Styles Logic and Tooltip Logic

I show an indicator of a status as a colored icon. The color change depends on the same logic as the Tooltip Text, so I set both values in a Styles Logic Block only. For that I have created a reusable function that sets the color and the tooltip text. The tooltip text can have 4 different entries as the result of the logic.

I wonder whether you can recommend the best possible approach:

  • use only styles Logic
  • use only Tooltip Logic
  • use both and put the same logic in both Logic Blocks

Hello @Jorg_Beyer

The best practice is - use both and put the same logic in both Logic Blocks

Logic handlers are reactive, if something was changed in the component - they should run again. So if you change some property(not just return a value) inside this handler it might run an infinite loop of re-renders.

I could advise you to create Custom Function which helps you not duplicate the code, and use this function in both places.

I have taken your advice but I struggle with the Tooltip Text Logic - my tooltipText is not shown. Do you have any sample Codeless Logic to learn from?

I do it like this:

Hello, @Jorg_Beyer.

You need to return a value from the handler instead of setting:
image

Best Regards, Nikita.