Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

122
Views
Embedding/Fixing Placement of Bootstrap 4.0 Tooltip in Shiny

I have tooltips working in my shiny app using just pure HTML. But, the placement of the tooltip isn't hovering over the button as I am trying to. My code to reproduce this is below. I thought placing the button in a div would cause for the tooltip to hover over the button, but clearly that's not right.

Any suggestions on how to get that tooltip to hover directly over the button when I mouseover the button?

Code below and not that the .js file lives in the www subdirectory of the app.

Edit

I found that if I use the following it hovers as expected over the button. Not sure if this is the best approach, but it seems to work.

tags$a(href = "#", `data-toggle`="tooltip", `data-placement`="top", title="Is this over my button", actionButton('button', 'Button'))

ui.R

library(shiny)
library(bslib)
library(shinyWidgets)
ui <- fluidPage(
    tags$head(
        tags$script(src = "myscript.js")
    ),
    navbarPage(
        theme = bs_theme(bootswatch = "litera"),
        title = 'Methods',
        tabPanel('One'),
        
    ),  
    sidebarLayout(
        sidebarPanel(
            fileInput('input0', 'Browse'),
            uiOutput("input1"),
        ),
        mainPanel(
            h1('Hello World!'),
            
            tags$div(class = "header", `data-toggle`="tooltip", `data-placement`="top", title="Tooltip on top", 
              actionButton('button', 'Button')
            )           
                    
        ),
    )
)

server.R

server <- function(input, output) {
output$input1 <- renderUI({
    selectInput("input1", "Choose:", letters[1:5])
})
}

myscript.js

$(function () {
  $('[data-toggle="tooltip"]').tooltip()
})
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Look at this bootstrap documentation. You have to initially link to popper.min.js, and try something like:

tags$head(
  tagList(
    tags$script(src = "myscript.js"),
    tags$script(src = "https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js")))
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!