rshinyshinybs

add shinyBS popover on disabled button


I haven't found any information in documentation of shinyBS and on the google/SO about how to use trigger = 'manual' on, for example, addPopover of shinyBS. I thought this would be the way to add a tooltip to a disabled button. (I dont want to do it with div'ving the button and giving title to div. Also would be nice if someone has a way to add tooltips reactively to shiny apps


Solution

  • Since shosaco's solution didnt work for me, I got it to work this way:

    if (input$disable) { 
      addCssClass("buttonId", "disabled")
      bsTooltip("buttonId", "This button is currently disabled.")
    } else {
      bsTooltip("buttonId", "")
      removeCssClass("buttonId", "disabled")
    }
    observeEvent(input$buttonId, {
        if (!input$disable) {
          output$text <- renderText("Bla")
        } else {
          output$text <- renderText(NULL)
        }