1

我想在selectInput里面放一个,dashboardHeaderPlus但这会使标题超出范围,甚至与边栏一样混乱,如图所示:

它的目的是让selectInput外观看起来像 facebook 搜索栏,这意味着居中而不影响标题,并在可能的情况下使用放大镜图标设置样式。像这样:

图片:实际输出/预期输出

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
library(shinyWidgets)


MenuProfesor <- function(){
    selectInput(inputId = "Search",
                label = NULL,
                selected = FALSE, 
                multiple = FALSE,
                choices = c('1','2','3','4'))
}

header <- dashboardHeaderPlus(
  title = 'Planificación UAI',
  enable_rightsidebar = FALSE,
  left_menu = tagList( MenuProfesor())
  )

ui <- dashboardPage(
  header,
  dashboardSidebar(),
  dashboardBody()
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
4

1 回答 1

0

这对你有用吗?:

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
library(shinyWidgets)

header <- dashboardHeaderPlus(
  title = 'Planificación UAI',
  tags$li(class = "dropdown",
          tags$li(class = "dropdown", div(searchInput(
            inputId = "search", 
            label = NULL, 
            placeholder = "Search...", 
            btnSearch = icon("search"), 
            btnReset = icon("remove"),
            width = "100%"
          ), style= "width: 25%; margin-left: auto; margin-right: auto; margin-top:-43px; margin-bottom:-10px;"))),
  enable_rightsidebar = FALSE,
  fixed = TRUE
)

ui <- dashboardPage(
  header,
  dashboardSidebar(),
  dashboardBody()
)

server <- function(input, output, session) {}

shinyApp(ui, server)

结果: 结果

此外,您可能想检查这个相关问题

于 2019-06-20T08:13:55.493 回答