library(shiny)
library(shinydashboard)
header <- dashboardHeader()
sidebar <- dashboardSidebar(
sidebarSearchForm(label = "Enter a number", "searchText", "searchButton"),
sidebarMenu(
# Setting id makes input$tabs give the tabName of currently-selected tab
id = "tabs",
menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard")),
menuItem("Widgets", icon = icon("th"), tabName = "widgets", badgeLabel = "new",
badgeColor = "green"),
menuItem("Charts", icon = icon("calendar"),
menuSubItem("Sub-item 1", tabName = "subitem1"),
menuSubItem("Sub-item 2", tabName = "subitem2")
)
)
)
body <- dashboardBody(
tabItems(
tabItem("dashboard",
div(p("Dashboard tab content"))
),
tabItem("widgets",
"Widgets tab content"
),
tabItem("subitem1",
"Sub-item 1 tab content"
),
tabItem("subitem2",
"Sub-item 2 tab content"
)
)
)
shinyApp(
ui = dashboardPage(header, sidebar, body),
server = function(input, output) { }
)
In our implementation, we could create a function that acts as a wrapper of [shiny semantic search functions](https://github.com/rstudio/shinydashboard/blob/main/R/dashboardSidebar.R#L188) and include - if needed - format to display it nicely on the sidebar. New arguments can be created appart from the current ones avaiable in shiny.dashboard.
Include a component similar to
shinydashboard::sidebarSearchFormusingshiny.semanticcomponentsThe
sidebarSearchFormis a ui component that queries a search and is placed on the sidebar.https://github.com/rstudio/shinydashboard/blob/main/R/dashboardSidebar.R#L188
It contains as argument a
textIdfor the id of the input text, abuttonIdfor the created icon button to be reactive in the server, alabelfor the label of the input and aniconfor selecting the icon that will act as a button.Here an example app of the
sidebarSearchFormIn our implementation, we could create a function that acts as a wrapper of [shiny semantic search functions](https://github.com/rstudio/shinydashboard/blob/main/R/dashboardSidebar.R#L188) and include - if needed - format to display it nicely on the sidebar. New arguments can be created appart from the current ones avaiable in
shiny.dashboard.