我正在尝试将全球搜索字段纳入我的navbarPage
经过一些tabPanel
。我不确定这是否可能,因为我所有的测试都产生了textInput
之外的navbar
.
rStudio 闪亮的布局指南指向引导导航栏文档 http://getbootstrap.com/components/#navbar,他们实际上就是这样做的。但我无法用我闪亮的应用程序重现它。
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)