简体   繁体   English

shiny 中下拉菜单的替代文本

[英]Alt text for a dropdown menu in shiny

If I'm using Microsoft word and I leave my mouse to hover over the font dropdown menu, this popup appears:如果我使用的是 Microsoft word,并且我将鼠标放在字体下拉菜单上的 hover 上,则会出现此弹出窗口:

字体的替代文字

It tells you the dropdown menu's name, what it's for and a shortcut to using it.它会告诉您下拉菜单的名称、用途以及使用它的快捷方式。

I have an Rshiny App with a dropdown menu, and I'd like to have a similar system to aid my users.我有一个带有下拉菜单的 Rshiny 应用程序,我希望有一个类似的系统来帮助我的用户。 How would I go about doing so?请问我go怎么办呢?

Here is some code to show where I'm starting from:这是一些代码来显示我从哪里开始:

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) {})

How about this这个怎么样

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) {})

在此处输入图像描述

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

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