Debian Codegraph @

man/fillPage.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/bootstrap.R
3 \name{fillPage}
4 \alias{fillPage}
5 \title{Create a page that fills the window}
6 \usage{
7 fillPage(
8 ...,
9 padding = 0,
10 title = NULL,
11 bootstrap = TRUE,
12 theme = NULL,
13 lang = NULL
14 )
15 }
16 \arguments{
17 \item{...}{Elements to include within the page.}
18
19 \item{padding}{Padding to use for the body. This can be a numeric vector
20 (which will be interpreted as pixels) or a character vector with valid CSS
21 lengths. The length can be between one and four. If one, then that value
22 will be used for all four sides. If two, then the first value will be used
23 for the top and bottom, while the second value will be used for left and
24 right. If three, then the first will be used for top, the second will be
25 left and right, and the third will be bottom. If four, then the values will
26 be interpreted as top, right, bottom, and left respectively.}
27
28 \item{title}{The title to use for the browser window/tab (it will not be
29 shown in the document).}
30
31 \item{bootstrap}{If \code{TRUE}, load the Bootstrap CSS library.}
32
33 \item{theme}{One of the following:
34 \itemize{
35 \item \code{NULL} (the default), which implies a "stock" build of Bootstrap 3.
36 \item A \code{\link[bslib:bs_theme]{bslib::bs_theme()}} object. This can be used to replace a stock
37 build of Bootstrap 3 with a customized version of Bootstrap 3 or higher.
38 \item A character string pointing to an alternative Bootstrap stylesheet
39 (normally a css file within the www directory, e.g. \code{www/bootstrap.css}).
40 }}
41
42 \item{lang}{ISO 639-1 language code for the HTML page, such as "en" or "ko".
43 This will be used as the lang in the \code{<html>} tag, as in \code{<html lang="en">}.
44 The default (NULL) results in an empty string.}
45 }
46 \description{
47 \code{fillPage} creates a page whose height and width always fill the
48 available area of the browser window.
49 }
50 \details{
51 The \code{\link[=fluidPage]{fluidPage()}} and \code{\link[=fixedPage]{fixedPage()}} functions are used
52 for creating web pages that are laid out from the top down, leaving
53 whitespace at the bottom if the page content's height is smaller than the
54 browser window, and scrolling if the content is larger than the window.
55
56 \code{fillPage} is designed to latch the document body's size to the size of
57 the window. This makes it possible to fill it with content that also scales
58 to the size of the window.
59
60 For example, \code{fluidPage(plotOutput("plot", height = "100\%"))} will not
61 work as expected; the plot element's effective height will be \code{0},
62 because the plot's containing elements (\verb{<div>} and \verb{<body>}) have
63 \emph{automatic} height; that is, they determine their own height based on
64 the height of their contained elements. However,
65 \code{fillPage(plotOutput("plot", height = "100\%"))} will work because
66 \code{fillPage} fixes the \verb{<body>} height at 100\% of the window height.
67
68 Note that \code{fillPage(plotOutput("plot"))} will not cause the plot to fill
69 the page. Like most Shiny output widgets, \code{plotOutput}'s default height
70 is a fixed number of pixels. You must explicitly set \code{height = "100\%"}
71 if you want a plot (or htmlwidget, say) to fill its container.
72
73 One must be careful what layouts/panels/elements come between the
74 \code{fillPage} and the plots/widgets. Any container that has an automatic
75 height will cause children with \code{height = "100\%"} to misbehave. Stick
76 to functions that are designed for fill layouts, such as the ones in this
77 package.
78 }
79 \examples{
80 fillPage(
81 tags$style(type = "text/css",
82 ".half-fill { width: 50\%; height: 100\%; }",
83 "#one { float: left; background-color: #ddddff; }",
84 "#two { float: right; background-color: #ccffcc; }"
85 ),
86 div(id = "one", class = "half-fill",
87 "Left half"
88 ),
89 div(id = "two", class = "half-fill",
90 "Right half"
91 ),
92 padding = 10
93 )
94
95 fillPage(
96 fillRow(
97 div(style = "background-color: red; width: 100\%; height: 100\%;"),
98 div(style = "background-color: blue; width: 100\%; height: 100\%;")
99 )
100 )
101 }
102 \seealso{
103 Other layout functions:
104 \code{\link{fixedPage}()},
105 \code{\link{flowLayout}()},
106 \code{\link{fluidPage}()},
107 \code{\link{navbarPage}()},
108 \code{\link{sidebarLayout}()},
109 \code{\link{splitLayout}()},
110 \code{\link{verticalLayout}()}
111 }
112 \concept{layout functions}