navs_tab {bslib}R Documentation

Navigation containers

Description

Render a collection of nav() items into a container.

Usage

navs_tab(..., id = NULL, selected = NULL, header = NULL, footer = NULL)

navs_pill(..., id = NULL, selected = NULL, header = NULL, footer = NULL)

navs_pill_list(
  ...,
  id = NULL,
  selected = NULL,
  header = NULL,
  footer = NULL,
  well = TRUE,
  fluid = TRUE,
  widths = c(4, 8)
)

navs_hidden(..., id = NULL, selected = NULL, header = NULL, footer = NULL)

navs_bar(
  ...,
  title = NULL,
  id = NULL,
  selected = NULL,
  position = c("static-top", "fixed-top", "fixed-bottom"),
  header = NULL,
  footer = NULL,
  bg = NULL,
  inverse = "auto",
  collapsible = TRUE,
  fluid = TRUE
)

navs_tab_card(..., id = NULL, selected = NULL, header = NULL, footer = NULL)

navs_pill_card(
  ...,
  id = NULL,
  selected = NULL,
  header = NULL,
  footer = NULL,
  placement = c("above", "below")
)

Arguments

...

a collection of nav() items.

id

a character string used for dynamically updating the container (see nav_select()).

selected

a character string matching the value of a particular nav() item to selected by default.

header

UI element(s) (tags) to display above the nav content.

footer

UI element(s) (tags) to display below the nav content.

well

TRUE to place a well (gray rounded rectangle) around the navigation list.

fluid

TRUE to use fluid layout; FALSE to use fixed layout.

widths

Column widths of the navigation list and tabset content areas respectively.

title

The title to display in the navbar

position

Determines whether the navbar should be displayed at the top of the page with normal scrolling behavior ("static-top"), pinned at the top ("fixed-top"), or pinned at the bottom ("fixed-bottom"). Note that using "fixed-top" or "fixed-bottom" will cause the navbar to overlay your body content, unless you add padding, e.g.: tags$style(type="text/css", "body {padding-top: 70px;}")

bg

a CSS color to use for the navbar's background color.

inverse

Either TRUE for a light text color or FALSE for a dark text color. If "auto" (the default), the best contrast to bg is chosen.

collapsible

TRUE to automatically collapse the navigation elements into a menu when the width of the browser is less than 940 pixels (useful for viewing on smaller touchscreen device)

placement

placement of the nav items relative to the content.

See Also

nav(), nav_select().

Examples


library(shiny)

nav_items <- function(prefix) {
  list(
    nav("a", paste(prefix, ": tab a content")),
    nav("b", paste(prefix, ": tab b content")),
    nav_item(
      tags$a(icon("github"), "Shiny", href = "https://github.com/rstudio/shiny", target = "_blank")
    ),
    nav_spacer(),
    nav_menu(
      "Other links", align = "right",
      nav("c", paste(prefix, ": tab c content")),
      nav_item(
        tags$a(icon("r-project"), "RStudio", href = "https://rstudio.com", target = "_blank")
      )
    )
  )
}

if (interactive()) {
  shinyApp(
    page_navbar(
      title = "page_navbar()",
      bg = "#0062cc",
      !!!nav_items("page_navbar()"),
      footer = div(
        style = "width:80%; margin: 0 auto",
        h4("navs_tab()"),
        navs_tab(!!!nav_items("navs_tab()")),
        h4("navs_pill()"),
        navs_pill(!!!nav_items("navs_pill()")),
        h4("navs_tab_card()"),
        navs_tab_card(!!!nav_items("navs_tab_card()")),
        h4("navs_pill_card()"),
        navs_pill_card(!!!nav_items("navs_pill_card()")),
        h4("navs_pill_list()"),
        navs_pill_list(!!!nav_items("navs_pill_list()"))
      )
    ),
    function(...) { }
  )
}

[Package bslib version 0.3.1 Index]