Is there a way to add a selectinput() inside shinydashboardPlus() header? I do not want the dropdown menu ability that is offered by shinydashboardPlus(). I want something like:

#app.r
library(shiny)
library(shinyWidgets)
library(shinydashboard)
library(shinydashboardPlus)
shinyApp(
ui = dashboardPagePlus(
header = dashboardHeaderPlus(
#selectInput("variable", "Variable:",
# c("Cylinders" = "cyl",
# "Transmission" = "am",
# "Gears" = "gear"))
),
sidebar = dashboardSidebar(),
body = dashboardBody(
),
rightsidebar = rightSidebar(),
title = "DashboardPage"
),
server = function(input, output) { }
)
shinydashboard is a little puritanical about the contents of the dashboardHeader.
There are two requirements for items to appear on the header. They need to have the li tag and they need to have the dropdown class. This normally limits you to only use the built in dropdown functions from the package. You can simply surround any widget you want to add with these and it will be added to the header.
Example:
dashboardHeader(
tags$li(selectInput('whatever','whatever',choices = c('meh1','meh2'),
class= 'dropdown'))
You might want to control the heights of the widgets you place though because long items cause header line to break at sidebar intersection. Default maximum height appears to be 50 px. You can fix the issue by increasing this size through css or reducing the height of the widgets you're adding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With