简体   繁体   English

将鼠标悬停在 R shiny 选择输入上时是否可以显示信息文本?

[英]Is it possible to display an info text when hovering over a R shiny selectInput?

I am currently building a shiny app to build biological networks.我目前正在构建一个 shiny 应用程序来构建生物网络。 To build them, you can choose between many different parameters, which i included in different selectInputs or numericInputs.要构建它们,您可以在许多不同的参数之间进行选择,这些参数包含在不同的 selectInputs 或 numericInputs 中。 Is it possible to have some kind of info text, when hovering the mouse over those input fields?将鼠标悬停在这些输入字段上时,是否可以有某种信息文本? I dont want to add 3-4 sentences of text to the title of each select/numericInput.我不想在每个 select/numericInput 的标题中添加 3-4 句文本。

Thanks:)谢谢:)

If you don't mind an extra package dependancy then you can use bsTooltip from the shinyBS package.如果你不介意额外的 package 依赖,那么你可以使用来自bsTooltip shinyBS的 bsTooltip。 Note that the hover tooltip sometimes doesn't show up unless you click on the input in the RStudio viewer pane, but if you run your app in your browser, the hover trigger should work:请注意,hover 工具提示有时不会显示,除非您单击 RStudio 查看器窗格中的输入,但如果您在浏览器中运行应用程序,则 hover 触发器应该可以工作:

library(shiny)
library(shinyBS)

ui <- fluidPage(
    selectInput("input1", "Select input", c("choice1", "choice2")),
    bsTooltip(id = "input1", 
              title = "Here is some text with your instructions")
)

server <- function(input, output) {
}

shinyApp(ui = ui, server = server)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM