I have a sliderInput
in a menuItem
which can be moved and the selected number needs to be displayed on the screen. Below is the code:
library(shiny)
library(shinydashboard)
sidebar <- dashboardSidebar(
sidebarMenu(
# Setting id makes input$tabs give the tabName of currently-selected tab
menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard"),
sliderInput("slider", "Slider Input", min = 0, max = 10, step = 1, value = 5))
)
)
body <- dashboardBody(
tabItems(
tabItem("dashboard", textOutput("Dashboard"))
)
)
ui <- dashboardPage(
dashboardHeader(),
sidebar,
body)
server <- function(input, output, session) {
output$Dashboard <- renderText({
paste("You've selected:", input$slider)
})
}
shinyApp(ui, server)
Ideally, I should see the number selected but that does not happen, unable to figure out where I am going wrong.