如何在闪亮的仪表板上制作信息按钮

问题描述 投票:1回答:2

我想在我闪亮的应用程序中显示一个信息按钮,用户可以在其中单击,然后弹出一个文本(信息)框,其中有一些文本。这是供用户单击按钮以获取有关我的闪亮应用程序某些部分的一般说明。

出于某种原因,出于这个目的,我无法在发光的或闪亮的仪表板上找到它。有人知道我该怎么做按钮吗?谢谢。

r shiny shinydashboard
2个回答
0
投票

这里有两种使用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)

enter image description hereenter image description here


0
投票

构建了一个名为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)

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.