File: navs.Rd

package info (click to toggle)
r-cran-bslib 0.4.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,332 kB
  • sloc: javascript: 10,075; makefile: 30; sh: 23
file content (178 lines) | stat: -rw-r--r-- 5,494 bytes parent folder | download
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/navs-legacy.R, R/navs.R
\name{navs_tab}
\alias{navs_tab}
\alias{navs_pill}
\alias{navs_pill_list}
\alias{navs_hidden}
\alias{navs_bar}
\alias{navs_tab_card}
\alias{navs_pill_card}
\title{Navigation containers}
\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,
  title = NULL,
  header = NULL,
  footer = NULL,
  height = NULL,
  full_screen = FALSE,
  wrapper = card_body
)

navs_pill_card(
  ...,
  id = NULL,
  selected = NULL,
  title = NULL,
  header = NULL,
  footer = NULL,
  height = NULL,
  placement = c("above", "below"),
  full_screen = FALSE,
  wrapper = card_body
)
}
\arguments{
\item{...}{a collection of \code{\link[=nav]{nav()}} items.}

\item{id}{a character string used for dynamically updating the container (see \code{\link[=nav_select]{nav_select()}}).}

\item{selected}{a character string matching the \code{value} of a particular \code{\link[=nav]{nav()}} item to selected by default.}

\item{header}{UI element(s) (\link{tags}) to display \emph{above} the nav content.}

\item{footer}{UI element(s) (\link{tags}) to display \emph{below} the nav content.}

\item{well}{\code{TRUE} to place a well (gray rounded rectangle) around the
navigation list.}

\item{fluid}{\code{TRUE} to use fluid layout; \code{FALSE} to use fixed
layout.}

\item{widths}{Column widths of the navigation list and tabset content areas
respectively.}

\item{title}{A (left-aligned) title to place in the card header/footer. If
provided, other nav items are automatically right aligned.}

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

\item{bg}{a CSS color to use for the navbar's background color.}

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

\item{collapsible}{\code{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)}

\item{height}{Any valid \link[htmltools:validateCssUnit]{CSS unit} (e.g.,
\code{height="200px"}).}

\item{full_screen}{If \code{TRUE}, an icon will appear when hovering over the card
body. Clicking the icon expands the card to fit viewport size. Consider
pairing this feature with \code{\link[=card_body_fill]{card_body_fill()}} to get output that responds to
changes in the size of the card.}

\item{wrapper}{A function (which returns a UI element) to call on unnamed
arguments in \code{...} which are not already card item(s) (like
\code{\link[=card_header]{card_header()}}, \code{\link[=card_body]{card_body()}}, etc.). Note that non-card items are grouped
together into one \code{wrapper} call (e.g. given \code{card("a", "b", card_body("c"), "d")}, \code{wrapper} would be called twice, once with \code{"a"} and
\code{"b"} and once with \code{"d"}). Consider setting \code{wrapper} to \link{card_body_fill}
if the entire card wants responsive sizing or \code{NULL} to avoid wrapping
altogether}

\item{placement}{placement of the nav items relative to the content.}
}
\description{
Render a collection of \code{\link[=nav]{nav()}} items into a container.
}
\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(...) { }
  )
}
}
\seealso{
\code{\link[=nav]{nav()}}, \code{\link[=nav_select]{nav_select()}}.
}