Conditional Visibility of Tooltips

0
In my app I have a home page with some cards. On each card I put a tooltip with some information on what will happen if you click the card. Now I want the user to have the option to disable these tooltips.To implement this I created a UserSetting entity with attribute ShowTooltips in my domain model. This entity is connected to Administration.Account with a 1-1 association. On my homepage I can retrieve the UserSetting using a dataview with microflow. I thought I could make a tooltip invisible by changing the visibility on the common tab of properties to: "$currentObject/ShowTooltips". However this hides not only the tooltip itself, but also the contents of the tooltip. In this case the card with text and icon that should remain visible for the user.I want to ask what is the best way to change the visibility on tooltips? Is there some property I am missing?As it stands the only solution I can think of is to duplicate each card and have 1 with tooltip and 1 without tooltip each with conditional visibility.
asked
3 answers
1

Hi Robin,
In Mendix, the Tooltip is not a separate widget but a property of the parent widget, so applying conditional visibility to it will hide the entire widget (your card) instead of just the tooltip. The correct approach is to make the tooltip dynamic by using an expression directly in the Tooltip property, such as if $currentObject/ShowTooltips then 'Your tooltip text' else ''. This way, when ShowTooltips is true, the tooltip is displayed, and when it is false, the tooltip is simply empty (effectively disabled) while the card remains visible. This is the most efficient and maintainable solution, and avoids unnecessary duplication of UI elements.

answered
1

The reason your current approach does not work is that Conditional visibility on the tooltip widget usually controls the entire widget, including the trigger/child content, not just the tooltip bubble itself. So when you hide the tooltip, you also hide the card content inside it.


A few cleaner options would be:


1. CSS class toggle (recommended)

This is usually the cleanest option if you have many cards. Instead of hiding the whole widget, you can add a dynamic class to the tooltip widget, for example:


if $currentObject/ShowTooltips then '' else 'hide-tooltip'


Then in your custom CSS/SCSS:

.hide-tooltip .mx-tooltip-text,
.hide-tooltip .tooltip {
    display: none !important;
}

You may need to adjust the selector a bit depending on which tooltip widget you are using, but the idea is to hide only the tooltip popup, not the card itself.


2. Empty string expression

If your tooltip text is set through a property/expression, an easier option is to make the tooltip text empty when ShowTooltips = false.


For example:

if $currentObject/ShowTooltips then $currentObject/TooltipText else ''


In many cases, if the tooltip text is empty, nothing is shown.


3. Wrapper/snippet approach

If you want to stay fully in Studio Pro and avoid CSS, another option is to use 2 wrappers:

  • one version with tooltip
  • one version without tooltip


But instead of duplicating the full card, put the card content in a Snippet. Then both wrappers use the same snippet, so maintenance stays manageable.


So overall, yes, your observation is correct: there is no separate built-in visibility setting just for the tooltip bubble itself. The best approach is usually either:

  • dynamic CSS class
  • empty tooltip text
  • or 2 wrappers + shared snippet


If this resolves your issue, please mark it as accepted.


answered
0

Hi,


This is a common misunderstanding with how tooltips work in Mendix.

Tooltips are not separate widgets — they are just a property on the widget itself. So when you apply conditional visibility, you’re actually controlling the entire widget (your card), not just the tooltip. That’s why your content is also getting hidden.

What you should do instead

Don’t try to control visibility.

Control the tooltip value dynamically.

Implementation

On your card (or container) → Tooltip property:

if $UserSetting/ShowTooltips 
then 'Your tooltip text' 
else ''

Why this works

  • When tooltip = empty → Mendix does not render a tooltip
  • Your card (text + icon) stays visible
  • No need to duplicate UI
  • Clean and maintainable

One thing to double-check

Make sure:

  • $UserSetting is available in the page context (via data view or page parameter)
  • You are not applying visibility anywhere on the card/container

Edge case

In some cases (rare, depending on widget/theme), empty string might still trigger a tooltip container.

If that happens, use:

if $UserSetting/ShowTooltips 
then 'Your tooltip text' 
else empty

What I would avoid

  • Duplicating cards (one with tooltip / one without)
  • Using visibility conditions for this
  • Adding extra microflows just for UI behavior


Tooltips in Mendix are a property of the widget, not a separate component. Applying conditional visibility will hide the entire widget instead of only the tooltip. The correct approach is to make the tooltip value dynamic using an expression. By returning an empty value when tooltips are disabled, the tooltip will not be shown while keeping the card content visible.

answered