I am trying to get a global search field into my navbarPage
after some tabPanel
. I am not sure if it is possible, since all my tests producing the
This is one possible way, to reconstruct the menu with HTML. It does not look very clean but it does what you are looking for.
app.R
library(shiny)
ui <- shinyUI(
tagList(
bootstrapPage(
HTML('
'),
tags$div(class="container-fluid",
tags$div(class="tab-content",
HTML(''),
sliderInput("bins1",
"Number of bins:",
min = 1,
max = 50,
value = 30),
plotOutput("distPlot1"),
verbatimTextOutput("searchBoxValuePlot1"),
HTML(''),
HTML(''),
sliderInput("bins2",
"Number of bins:",
min = 1,
max = 50,
value = 30),
plotOutput("distPlot2"),
verbatimTextOutput("searchBoxValuePlot2"),
HTML('')
)
)
)
))
server <- function(input, output, session) {
output$distPlot1 <- renderPlot({
# generate bins based on input$bins from ui.R
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins1 + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
output$distPlot2 <- renderPlot({
# generate bins based on input$bins from ui.R
x <- faithful[, 1]
bins <- seq(min(x), max(x), length.out = input$bins2 + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
searchBoxValue <- reactive({
input$searchBox
})
output$searchBoxValuePlot1 <- renderPrint({
paste("You entered: ", searchBoxValue(), "and you are on the first link", sep = " ")
})
output$searchBoxValuePlot2 <- renderPrint({
paste("You entered: ", searchBoxValue(), "and you are on the second link", sep = " ")
})
}
shinyApp(ui, server)