我想在我闪亮的应用程序中显示一个信息按钮,用户可以在其中单击,然后弹出一个文本(信息)框,其中有一些文本。这是供用户单击按钮以获取有关我的闪亮应用程序某些部分的一般说明。
出于某种原因,出于这个目的,我无法在发光的或闪亮的仪表板上找到它。有人知道我该怎么做按钮吗?谢谢。
这里有两种使用shinyWidgets包中的'dropMenu()和注释中建议的modal dialogue的可能性。在此示例中,在仪表板标题中放置了一个按钮,用于打开信息面板,或者可以单击仪表板主体中的操作按钮以调出单独的窗口。
放置在仪表板标题中的按钮将使其持久存在,而与激活的选项卡无关。如果需要始终访问菜单,这可能会有所帮助。
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)
构建了一个名为rintrojs
的简洁程序包,它使您能够描述有光泽的应用程序的操作,您可以将任何对象包装到其中。可以在此处找到更多示例https://github.com/carlganz/rintrojs
library(shiny)
library(rintrojs)
ui <- fluidPage(
introjsUI(),
column(2,
br(),
actionButton("help", "About this Page")
),
column(2,
introBox(
selectInput("Task", label = "Select Task",choices = c("Please select","Upload","Analyze Data")),
data.step = 1,data.intro = "This is the selectInput called Task, you do xyz with this"
)
),
column(2,
introBox(
selectInput(
"breaks", "Breaks",
c("Sturges",
"Scott",
"Freedman-Diaconis",
"[Custom]" = "custom")),
data.step = 2,data.intro = "This is the selectInput called breaks, you do xyz with this"
)
),
column(2,
introBox(
sliderInput("breakCount", "Break Count", min=1, max=1000, value=10),
data.step = 3,data.intro = "This is the sliderInput called breakCount, you do xyz with this"
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output,session) {
observeEvent(input$help,
introjs(session, options = list("showBullets"="false", "showProgress"="true",
"showStepNumbers"="false","nextLabel"="Next","prevLabel"="Prev","skipLabel"="Skip"))
)
}
# Run the application
shinyApp(ui = ui, server = server)