File: fillPage.Rd

package info (click to toggle)
r-cran-shiny 1.0.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,080 kB
  • ctags: 290
  • sloc: makefile: 22; sh: 13
file content (84 lines) | stat: -rw-r--r-- 3,353 bytes parent folder | download | duplicates (2)
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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bootstrap.R
\name{fillPage}
\alias{fillPage}
\title{Create a page that fills the window}
\usage{
fillPage(..., padding = 0, title = NULL, bootstrap = TRUE, theme = NULL)
}
\arguments{
\item{...}{Elements to include within the page.}

\item{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.}

\item{title}{The title to use for the browser window/tab (it will not be
shown in the document).}

\item{bootstrap}{If \code{TRUE}, load the Bootstrap CSS library.}

\item{theme}{URL to alternative Bootstrap stylesheet.}
}
\description{
\code{fillPage} creates a page whose height and width always fill the
available area of the browser window.
}
\details{
The \code{\link{fluidPage}} and \code{\link{fixedPage}} functions are used
for creating web pages that are laid out from the top down, leaving
whitespace at the bottom if the page content's height is smaller than the
browser window, and scrolling if the content is larger than the window.

\code{fillPage} is designed to latch the document body's size to the size of
the window. This makes it possible to fill it with content that also scales
to the size of the window.

For example, \code{fluidPage(plotOutput("plot", height = "100\%"))} will not
work as expected; the plot element's effective height will be \code{0},
because the plot's containing elements (\code{<div>} and \code{<body>}) have
\emph{automatic} height; that is, they determine their own height based on
the height of their contained elements. However,
\code{fillPage(plotOutput("plot", height = "100\%"))} will work because
\code{fillPage} fixes the \code{<body>} height at 100\% of the window height.

Note that \code{fillPage(plotOutput("plot"))} will not cause the plot to fill
the page. Like most Shiny output widgets, \code{plotOutput}'s default height
is a fixed number of pixels. You must explicitly set \code{height = "100\%"}
if you want a plot (or htmlwidget, say) to fill its container.

One must be careful what layouts/panels/elements come between the
\code{fillPage} and the plots/widgets. Any container that has an automatic
height will cause children with \code{height = "100\%"} to misbehave. Stick
to functions that are designed for fill layouts, such as the ones in this
package.
}
\examples{
fillPage(
  tags$style(type = "text/css",
    ".half-fill { width: 50\%; height: 100\%; }",
    "#one { float: left; background-color: #ddddff; }",
    "#two { float: right; background-color: #ccffcc; }"
  ),
  div(id = "one", class = "half-fill",
    "Left half"
  ),
  div(id = "two", class = "half-fill",
    "Right half"
  ),
  padding = 10
)

fillPage(
  fillRow(
    div(style = "background-color: red; width: 100\%; height: 100\%;"),
    div(style = "background-color: blue; width: 100\%; height: 100\%;")
  )
)
}