Description Usage Arguments Including a menu See Also Examples
A reactive input styled as a navigation control. The navigation input can be
styled as links, tabs, or pills. A nav input is paired with navContent()
and showNavPane() to create tabbed user interfaces. Observers and reactives
are triggered when a nav choice or menu item is clicked. The reactive value
of a nav input is NULL or a singleton character string. The value of any
menus in the nav input must be retrieved with its own reactive id.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 
| id | A character string specifying the id of the reactive input. | 
| choices | A character vector or list of tag elements specifying the navigation items of the input. | 
| values | A character vector specifying the values of the input's
choices, defaults to  | 
| selected | One of  | 
| ... | Additional named arguments passed as HTML attributes to the parent element or tag elements passed as child elements to the parent element. | 
| appearance | One of  | 
| fill | One of  | 
| enable | One of  | 
| disable | One of  | 
| session | A reactive context, defaults to  | 
Use the reactive id of any nav menus to know when a menu item is clicked.
ui <- navInput(
  id = "navigation",
  choices = list(
    "Item 1",
    "Item 2",
    menuInput(
      id = "navMenu",  # <-
      label = "Item 3",
      choices = c("Choice 1", "Choice 2")
    )
  ),
  values = c("item1", "item2", "item3")
)
server <- function(input, output) {
  observeEvent(input$navMenu, {
    cat(paste("Click menu item:", input$navMenu, "\n"))
  })
}
shinyApp(ui, server)
Other inputs: 
buttonGroupInput(),
buttonInput(),
checkbarInput(),
checkboxInput(),
chipInput(),
fileInput(),
formInput(),
listGroupInput(),
menuInput(),
radioInput(),
radiobarInput(),
rangeInput(),
selectInput(),
textInput()
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | ### Nav styled as tabs
navInput(
  id = "tabs1",
  choices = c(
    "Tab 1",
    "Tab 2",
    "Tab 3"
  ),
  selected = "Tab 1",
  appearance = "tabs"
)
### Nav styled as pills
navInput(
  id = "tabs2",
  choices = paste("Tab", 1:3),
  selected = "Tab 1",
  appearance = "pills"
)
### Nav with dropdown
navInput(
  id = "tabs3",
  choices = list(
    "Tab 1",
    menuInput(
      id = "menu1",
      label = "Tab 2",
      choices = c(
        "Action",
        "Another action"
      )
    ),
    "Tab 2"
  ),
  values = c("tab1", "tab2", "tab3")
)
### Full width nav input
navInput(
  id = "tabs4",
  choices = paste("Tab", 1:5),
  values = paste0("tab", 1:5),
  appearance = "pills",
  fill = TRUE
)
### Centering a nav input
navInput(
  id = "tabs5",
  choices = paste("Tab", 1:3)
) %>%
  flex(justify = "center")
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.