我想在我闪亮的应用程序中显示一个信息按钮,用户可以在其中单击,然后弹出一个文本(信息)框,并在其中显示一些文本。这是供用户单击按钮以获取有关我的闪亮应用程序某些部分的一般说明。
出于某种原因,出于这个目的,我无法在发亮的面板中找到它。有人知道我该怎么做按钮吗?谢谢。
这有两种可能,可以使用ShinyWidgets软件包中的'dropMenu()'和注释中建议的模式对话框。在此示例中,在仪表板标题中放置了一个按钮,用于打开信息面板,或者可以单击仪表板主体中的操作按钮以调出单独的窗口。
将按钮放置在仪表板标题中将使该按钮持久存在,而与激活的选项卡无关。如果需要始终访问菜单,这可能会有所帮助。
library(shiny)
library(shinydashboard)
library(shinyWidgets)
ui <- dashboardPage(
dashboardHeader( title = "app",
tags$li(class = "dropdown",
dropMenu(
dropdownButton("Info", status = 'success', icon = icon('info')),
h3(strong('Information')),
br(),
h5('This is really helpful'),
textInput('text', 'You can also put UI elements here'),
placement = "bottom",
arrow = TRUE)
)
)
,
dashboardSidebar(),
dashboardBody(actionButton('help', 'Help'))
)
server <- function(input, output) {
observeEvent(input$help,{
showModal(modalDialog(
title = "Help!",
"Information",
textInput('text2', 'You can also put UI elements here')
))
})
}
shinyApp(ui, server)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句