navInput: Page navigation inputs

View source: R/input-nav.R

navInputR Documentation

Page navigation inputs

Description

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.

Usage

navInput(
  ...,
  id,
  choices = NULL,
  values = choices,
  selected = values[[1]],
  appearance = "links",
  fill = FALSE
)

updateNavInput(
  id,
  choices = NULL,
  values = choices,
  selected = NULL,
  enable = NULL,
  disable = NULL,
  session = getDefaultReactiveDomain()
)

Arguments

...

Additional named arguments passed as HTML attributes to the parent element or tag elements passed as child elements to the parent element.

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 choices.

selected

One of values specifying which choice is selected by default, defaults to values[[1]].

appearance

One of "links", "pills", or "tabs" specifying the appearance of the nav input, defaults to "links".

fill

One of TRUE or FALSE specifying if the nav input fills the width of its parent element. If TRUE, the space is divided evenly among the nav items.

enable

One of values specifying particular choices to enable or TRUE specifying the entire input is enabled, defaults to NULL.

disable

One of values specifying particular choices to disable or TRUE specifying the entire input is disabled, defaults to NULL.

session

A reactive context, defaults to getDefaultReactiveDomain().

Details

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(
  .style %>%
    flex(justify = "center"),
  id = NULL,
  choices = c("Tab 1", "Tab 2", "Tab 3")
)

See Also

Other inputs: buttonGroupInput(), buttonInput(), checkbarInput(), checkboxInput(), chipInput(), fileInput(), formInput(), listGroupInput(), menuInput(), radioInput(), radiobarInput(), rangeInput(), selectInput(), textInput()


nteetor/yonder documentation built on June 8, 2022, 1:36 p.m.