Conditionally activate Material UI tooltip? Conditionally activate Material UI tooltip? reactjs reactjs

Conditionally activate Material UI tooltip?


Should be

 <Tooltip title={warningText == null ? "" : warningText}>        <Button>Do action</Button> </Tooltip>

the docs say that it won't be displayed if the string length is zero.

https://material-ui.com/api/tooltip/

Tooltip title. Zero-length titles string are never displayed.


You should take a look at https://material-ui.com/api/tooltip/

There are options like

  • disableFocusListener
  • disableHoverListener
  • disableTouchListener
  • interactive

I think interactive={true} should fit your needs best

<Tooltip title={warningText} interactive={!warningText}>...</Tooltip>