闪亮仪表板 'topbar'
Shinydashboard 'topbar'
是否可以在 dashboardHeader
旁边的水平栏中放置一些项目?我知道您可以像 this example 一样将 notificationItem
放在最右边。但我想使用与 dashboardSidebar
中相同的选项,例如添加过滤器等。我希望在顶部添加这样的过滤器:
您好,您可以这样做:
library(shiny)
library(shinydashboard)
CustomHeader <- dashboardHeader()
CustomHeader$children[[3]]$children <- div(style="min-width:200px;",tags$input(id="searchbox",placeholder = " Search...",type="text",class="chooser-input-search",style="width:200px;height:50px;"))
ui <- dashboardPage(
CustomHeader,
dashboardSidebar(),
dashboardBody()
)
server <- function(input, output, session) {}
shinyApp(ui, server)
根据 Pork Chop 的回答,您可以简单地使用 selectInput
(或其他有光泽的输入),您将其放入 div
和 float:left
以水平跨越:
CustomHeader <- dashboardHeader()
CustomHeader$children[[3]]$children <- list(
div(style="float:left;height:50px",selectInput("select1", NULL, c("a","b","c"))),
div(style="float:left;height:50px",selectInput("select2", NULL, c("d","e","f"))))
ui <- dashboardPage(
CustomHeader,
dashboardSidebar(),
dashboardBody(textOutput("text1"),textOutput("text2"))
)
server <- function(input, output, session) {
output$text1 <- renderText({input$select1})
output$text2 <- renderText({input$select2})
}
shinyApp(ui, server)
是否可以在 dashboardHeader
旁边的水平栏中放置一些项目?我知道您可以像 this example 一样将 notificationItem
放在最右边。但我想使用与 dashboardSidebar
中相同的选项,例如添加过滤器等。我希望在顶部添加这样的过滤器:
您好,您可以这样做:
library(shiny)
library(shinydashboard)
CustomHeader <- dashboardHeader()
CustomHeader$children[[3]]$children <- div(style="min-width:200px;",tags$input(id="searchbox",placeholder = " Search...",type="text",class="chooser-input-search",style="width:200px;height:50px;"))
ui <- dashboardPage(
CustomHeader,
dashboardSidebar(),
dashboardBody()
)
server <- function(input, output, session) {}
shinyApp(ui, server)
根据 Pork Chop 的回答,您可以简单地使用 selectInput
(或其他有光泽的输入),您将其放入 div
和 float:left
以水平跨越:
CustomHeader <- dashboardHeader()
CustomHeader$children[[3]]$children <- list(
div(style="float:left;height:50px",selectInput("select1", NULL, c("a","b","c"))),
div(style="float:left;height:50px",selectInput("select2", NULL, c("d","e","f"))))
ui <- dashboardPage(
CustomHeader,
dashboardSidebar(),
dashboardBody(textOutput("text1"),textOutput("text2"))
)
server <- function(input, output, session) {
output$text1 <- renderText({input$select1})
output$text2 <- renderText({input$select2})
}
shinyApp(ui, server)