我试图在tabPanel
之后得到一个全局搜索字段到我的navbarPage
。我不确定是否有可能,因为我的所有测试在navbar
之外生成textInput
。闪亮navbarPage中的搜索字段
rStudio闪亮的布局指南指向bootstrap navbar documentation,他们在那里确实做到了这一点。但我无法用我的闪亮应用重现它。
library(shiny)
ui <- shinyUI(
shiny::navbarPage('test',
shiny::tabPanel('my app',
fluidPage(
# Application title
titlePanel("Old Faithful Geyser Data"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot")
)
))),
### Still inside navbarPage
shiny::textInput("text",
label=h3("Text input"),
value="should be inside the navbar!")
))
server <- function(input, output, session) {
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
}
shinyApp(ui, server)
这可能有一些你想要做什么的见解http://stackoverflow.com/questions/36360146/checkbox-widget-within-navbar-shiny。 – emilliman5