page_navbar | R Documentation |
Create a page that contains a top level navigation bar that can be used to
toggle a set of nav_panel()
elements. Use this page layout to create the
effect of a multi-page app, where your app's content is broken up into
multiple "pages" that can be navigated to via the top navigation bar.
page_navbar(
...,
title = NULL,
id = NULL,
selected = NULL,
sidebar = NULL,
fillable = TRUE,
fillable_mobile = FALSE,
gap = NULL,
padding = NULL,
position = c("static-top", "fixed-top", "fixed-bottom"),
header = NULL,
footer = NULL,
bg = NULL,
inverse = "auto",
underline = TRUE,
collapsible = TRUE,
fluid = TRUE,
theme = bs_theme(),
window_title = NA,
lang = NULL
)
... |
a collection of |
title |
A (left-aligned) title to place in the card header/footer. If provided, other nav items are automatically right aligned. |
id |
a character string used for dynamically updating the container (see
|
selected |
a character string matching the |
sidebar |
A |
fillable |
Whether or not to allow |
fillable_mobile |
Whether or not |
gap |
A CSS length unit defining the
|
padding |
Padding to use for the body. This can be a numeric vector (which will be interpreted as pixels) or a character vector with valid CSS lengths. The length can be between one and four. If one, then that value will be used for all four sides. If two, then the first value will be used for the top and bottom, while the second value will be used for left and right. If three, then the first will be used for top, the second will be left and right, and the third will be bottom. If four, then the values will be interpreted as top, right, bottom, and left respectively. |
position |
Determines whether the navbar should be displayed at the top
of the page with normal scrolling behavior ( |
header |
UI element(s) (htmltools::tags) to display above the nav content. |
footer |
UI element(s) (htmltools::tags) to display below the nav content. |
bg |
a CSS color to use for the navbar's background color. |
inverse |
Either |
underline |
Whether or not to add underline styling to page links when active or focused. |
collapsible |
|
fluid |
|
theme |
A |
window_title |
the browser window title. The default value, |
lang |
ISO 639-1 language code for the HTML page, such as "en" or "ko".
This will be used as the lang in the |
Getting Started with Dashboards on the bslib website.
nav_panel()
, nav_menu()
, and nav_item()
for adding content
sections and organizing or creating items in the navigation bar.
layout_columns()
and layout_column_wrap()
for laying out content
into rows and columns.
card()
for wrapping outputs in the 'main' content area.
value_box()
for highlighting values.
accordion()
for grouping related input controls in the sidebar
.
Other Dashboard page layouts:
page_fillable()
,
page_sidebar()
library(shiny)
library(bslib)
link_shiny <- tags$a(
shiny::icon("github"), "Shiny",
href = "https://github.com/rstudio/shiny",
target = "_blank"
)
link_posit <- tags$a(
shiny::icon("r-project"), "Posit",
href = "https://posit.co",
target = "_blank"
)
ui <- page_navbar(
title = "My App",
nav_panel(title = "One", p("First page content.")),
nav_panel(title = "Two", p("Second page content.")),
nav_panel("Three", p("Third page content.")),
nav_spacer(),
nav_menu(
title = "Links",
align = "right",
nav_item(link_shiny),
nav_item(link_posit)
)
)
server <- function(...) { } # not used in this example
shinyApp(ui, server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.