Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

123
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda