闪亮下拉菜单的替代文字

Alt text for a dropdown menu in shiny

如果我使用 Microsoft word 并将鼠标悬停在字体下拉菜单上,则会出现此弹出窗口:

它会告诉您下拉菜单的名称、用途以及使用它的快捷方式。

我有一个带下拉菜单的 Rshiny 应用程序,我希望有一个类似的系统来帮助我的用户。我该怎么做?

这里有一些代码显示我从哪里开始:

library(shiny)

ui <- fixedPage(
  # The alt-text would say "Choose from 3 options"
  fixedRow(selectInput("drop", "Features", choices = c(1,2,3))))

shinyApp(ui, server = function(input, output) {})

这个怎么样

library(shiny)
library(spsComps)
library(magrittr)
ui <- fixedPage(
    # The alt-text would say "Choose from 3 options"
    fixedRow(
        # since the dropdown will expand the element height, place on top or bottom is not ideal.
        column(
            6, 
            # use `bsPopover` for full customization
            selectInput("drop1", "Features", choices = c(1,2,3), width="50%") %>% 
                bsPopover("XX dropdown", "Choose from 3 options", "right")
        ),
        column(
            6, 
            # or the convenient function `bsPop` with preset colors
            selectInput("drop2", "Features", choices = c(1,2,3), width="50%") %>% 
                bsPop("XX dropdown", "Choose from 3 options", "left", status = "primary")
        )
    )
)

shinyApp(ui, server = function(input, output) {})