Compare commits

...

8 Commits

Author SHA1 Message Date
cpsievert
4671eccd84 devtools::document() (GitHub Actions) 2022-01-20 19:46:41 +00:00
Carson
6c0cf4f7e5 code review 2022-01-20 13:41:31 -06:00
cpsievert
dc7d4b46d8 devtools::document() (GitHub Actions) 2022-01-20 18:31:22 +00:00
Carson Sievert
509acb62b0 Update R/bootstrap-deprecated.R 2022-01-20 12:24:32 -06:00
Carson
d05b2c305e roxygenize 2022-01-20 12:24:32 -06:00
Carson
a562e286d0 Improve organization of function reference 2022-01-20 12:24:32 -06:00
Carson
a40903c7e3 Improve documentation surrounding fluidPage/fixedRow/bootstrapPage and fluidRow/column 2022-01-20 12:24:32 -06:00
Carson
1faefe66fa Soft deprecate fixedRow() and basicPage() 2022-01-20 12:24:32 -06:00
14 changed files with 338 additions and 551 deletions

View File

@@ -1,87 +1,4 @@
#' Create a page with fluid layout
#'
#' Functions for creating fluid page layouts. A fluid page layout consists of
#' rows which in turn include columns. Rows exist for the purpose of making sure
#' their elements appear on the same line (if the browser has adequate width).
#' Columns exist for the purpose of defining how much horizontal space within a
#' 12-unit wide grid it's elements should occupy. Fluid pages scale their
#' components in realtime to fill all available browser width.
#'
#' @param ... Elements to include within the page
#' @param title The browser window title (defaults to the host URL of the page).
#' Can also be set as a side effect of the [titlePanel()] function.
#' @inheritParams bootstrapPage
#'
#' @return A UI defintion that can be passed to the [shinyUI] function.
#'
#' @details To create a fluid page use the `fluidPage` function and include
#' instances of `fluidRow` and [column()] within it. As an
#' alternative to low-level row and column functions you can also use
#' higher-level layout functions like [sidebarLayout()].
#'
#' @note See the [
#' Shiny-Application-Layout-Guide](https://shiny.rstudio.com/articles/layout-guide.html) for additional details on laying out fluid
#' pages.
#'
#' @family layout functions
#' @seealso [column()]
#'
#' @examples
#' ## Only run examples in interactive R sessions
#' if (interactive()) {
#'
#' # Example of UI with fluidPage
#' ui <- fluidPage(
#'
#' # Application title
#' titlePanel("Hello Shiny!"),
#'
#' sidebarLayout(
#'
#' # Sidebar with a slider input
#' sidebarPanel(
#' sliderInput("obs",
#' "Number of observations:",
#' min = 0,
#' max = 1000,
#' value = 500)
#' ),
#'
#' # Show a plot of the generated distribution
#' mainPanel(
#' plotOutput("distPlot")
#' )
#' )
#' )
#'
#' # Server logic
#' server <- function(input, output) {
#' output$distPlot <- renderPlot({
#' hist(rnorm(input$obs))
#' })
#' }
#'
#' # Complete app with UI and server components
#' shinyApp(ui, server)
#'
#'
#' # UI demonstrating column layouts
#' ui <- fluidPage(
#' title = "Hello Shiny!",
#' fluidRow(
#' column(width = 4,
#' "4"
#' ),
#' column(width = 3, offset = 2,
#' "3 offset 2"
#' )
#' )
#' )
#'
#' shinyApp(ui, server = function(input, output) { })
#' }
#' @rdname fluidPage
#' @rdname bootstrapPage
#' @export
fluidPage <- function(..., title = NULL, theme = NULL, lang = NULL) {
bootstrapPage(div(class = "container-fluid", ...),
@@ -91,62 +8,13 @@ fluidPage <- function(..., title = NULL, theme = NULL, lang = NULL) {
}
#' @rdname fluidPage
#' @rdname column
#' @export
fluidRow <- function(...) {
div(class = "row", ...)
}
#' Create a page with a fixed layout
#'
#' Functions for creating fixed page layouts. A fixed page layout consists of
#' rows which in turn include columns. Rows exist for the purpose of making sure
#' their elements appear on the same line (if the browser has adequate width).
#' Columns exist for the purpose of defining how much horizontal space within a
#' 12-unit wide grid it's elements should occupy. Fixed pages limit their width
#' to 940 pixels on a typical display, and 724px or 1170px on smaller and larger
#' displays respectively.
#'
#' @param ... Elements to include within the container
#' @param title The browser window title (defaults to the host URL of the page)
#' @inheritParams bootstrapPage
#'
#' @return A UI defintion that can be passed to the [shinyUI] function.
#'
#' @details To create a fixed page use the `fixedPage` function and include
#' instances of `fixedRow` and [column()] within it. Note that
#' unlike [fluidPage()], fixed pages cannot make use of higher-level
#' layout functions like `sidebarLayout`, rather, all layout must be done
#' with `fixedRow` and `column`.
#'
#' @note See the [
#' Shiny Application Layout Guide](https://shiny.rstudio.com/articles/layout-guide.html) for additional details on laying out fixed
#' pages.
#'
#' @family layout functions
#'
#' @seealso [column()]
#'
#' @examples
#' ## Only run examples in interactive R sessions
#' if (interactive()) {
#'
#' ui <- fixedPage(
#' title = "Hello, Shiny!",
#' fixedRow(
#' column(width = 4,
#' "4"
#' ),
#' column(width = 3, offset = 2,
#' "3 offset 2"
#' )
#' )
#' )
#'
#' shinyApp(ui, server = function(input, output) { })
#' }
#'
#' @rdname fixedPage
#' @rdname bootstrapPage
#' @export
fixedPage <- function(..., title = NULL, theme = NULL, lang = NULL) {
bootstrapPage(div(class = "container", ...),
@@ -155,28 +23,39 @@ fixedPage <- function(..., title = NULL, theme = NULL, lang = NULL) {
lang = lang)
}
#' @rdname fixedPage
#' @rdname column
#' @export
fixedRow <- function(...) {
div(class = "row", ...)
}
#' Create a column within a UI definition
#' Responsive row-column based layout
#'
#' Create a column for use within a [fluidRow()] or
#' [fixedRow()]
#' Layout UI components using Bootstrap's grid layout system. Use
#' `fluidRow()` to group elements that should appear on the same line (if the
#' browser has adequate width) and `column()` to define how much horizontal
#' space within a 12-unit wide grid each on of these elements should occupy. See
#' the [layout guide](https://shiny.rstudio.com/articles/layout-guide.html) for
#' more context and examples.
#'
#' @param width The grid width of the column (must be between 1 and 12)
#' @param ... Elements to include within the column
#' To work properly, these functions need [Bootstrap](https://getbootstrap.com)
#' included on the page. Since most Shiny apps use [bootstrapPage()]
#' under-the-hood, this is usually the case, but custom page containers (i.e.,
#' [htmlTemplate()]) may need to explicitly include [bootstrapLib()]
#' dependencies.
#'
#' @param width The grid width of the column (must be between 1 and 12). When
#' the device width is small (e.g., the viewer is on a mobile phone), the
#' width is always 12. For more control over these responsive breakpoints, use
#' Bootstrap's grid system more directly (e.g., `fluidRow(div(class =
#' "col-lg-2", ...))`).
#' @param ... UI elements (i.e., [tags]). For `fluidRow()`, `...` should be a set of `column()`s.
#' @param offset The number of columns to offset this column from the end of the
#' previous column.
#'
#' @return A column that can be included within a
#' [fluidRow()] or [fixedRow()].
#' @return A UI element (i.e., [tags]).
#'
#'
#' @seealso [fluidRow()], [fixedRow()].
#' @seealso [fluidPage()]
#'
#' @examples
#' ## Only run examples in interactive R sessions
@@ -202,16 +81,10 @@ fixedRow <- function(...) {
#'
#' shinyApp(ui, server)
#'
#'
#'
#' ui <- fluidPage(
#' fluidRow(
#' column(width = 4,
#' "4"
#' ),
#' column(width = 3, offset = 2,
#' "3 offset 2"
#' )
#' column(width = 4, "4"),
#' column(width = 3, offset = 2, "3 offset 2")
#' )
#' )
#' shinyApp(ui, server = function(input, output) { })

View File

@@ -1,36 +1,84 @@
#' @include utils.R
NULL
#' Create a Bootstrap page
#' Create a Bootstrap UI page container
#'
#' Create a Shiny UI page that loads the CSS and JavaScript for
#' [Bootstrap](https://getbootstrap.com/), and has no content in the page
#' body (other than what you provide).
#' @description
#' Create a user interface (UI) page container based on
#' [Bootstrap](https://getbootstrap.com/)'s CSS and JavaScript. Most Shiny apps
#' should use [fluidPage()] (or [navbarPage()]) to get a page container with a
#' responsive page width, but in some cases you may want a fixed width container
#' (`fixedPage()`) or just a bare `<body>` container (`bootstrapPage()`).
#'
#' This function is primarily intended for users who are proficient in HTML/CSS,
#' and know how to lay out pages in Bootstrap. Most applications should use
#' [fluidPage()] along with layout functions like
#' [fluidRow()] and [sidebarLayout()].
#' Most Shiny apps make use of other Shiny UI functions for [managing
#' layout](https://shiny.rstudio.com/articles/layout-guide.html) (e.g.,
#' [sidebarLayout()], [fluidRow()], etc), navigation (e.g., [tabPanel()]), and
#' other styling (e.g., [wellPanel()], [inputPanel()]). A good portion of these
#' Shiny UI functions require Bootstrap to work properly (so most Shiny apps
#' should use these functions to start their UI definitions), but more advanced
#' usage (i.e., custom HTML/CSS/JS) can avoid Bootstrap entirely by using
#' [htmlTemplate()] and/or HTML [tags].
#'
#' @param ... The contents of the document body.
#' @param title The browser window title (defaults to the host URL of the page)
#' @param ... UI elements (i.e., [tags]).
#' @param title The browser window title (defaults to the host URL of the page).
#' Can also be set as a side effect of the [titlePanel()] function.
#' @param theme One of the following:
#' * `NULL` (the default), which implies a "stock" build of Bootstrap 3.
#' * A [bslib::bs_theme()] object. This can be used to replace a stock
#' build of Bootstrap 3 with a customized version of Bootstrap 3 or higher.
#' * A character string pointing to an alternative Bootstrap stylesheet
#' (normally a css file within the www directory, e.g. `www/bootstrap.css`).
#' This option is here mainly for legacy reasons.
#' @param lang ISO 639-1 language code for the HTML page, such as "en" or "ko".
#' This will be used as the lang in the \code{<html>} tag, as in \code{<html lang="en">}.
#' This will be used as the lang in the `<html>` tag, as in `<html lang="en">`.
#' The default (NULL) results in an empty string.
#'
#' @return A UI defintion that can be passed to the [shinyUI] function.
#' @return A UI definition (i.e., a [tags] object) that can be passed to [shinyApp()].
#'
#' @note The `basicPage` function is deprecated, you should use the
#' [fluidPage()] function instead.
#'
#' @seealso [fluidPage()], [fixedPage()]
#' @seealso [navbarPage()], [fillPage()], [column()], [tabPanel()]
#' @export
#' @examples
#'
#' # First create some UI content.
#' # See the layout guide to learn more about creating different layouts
#' # https://shiny.rstudio.com/articles/layout-guide.html
#' ui <- sidebarLayout(
#' sidebarPanel(sliderInput("obs", "Number of observations:", 0, 1000, 500)),
#' mainPanel(plotOutput("distPlot"))
#' )
#' server <- function(input, output) {
#' output$distPlot <- renderPlot(hist(rnorm(input$obs)))
#' }
#'
#' # Demonstrating difference between fluidPage(), fixedPage(), bootstrapPage()
#' if (interactive()) {
#' # Container width scales _fluidly_ with window size
#' shinyApp(fluidPage(ui), server)
#' # Container width changes with window size at fixed breakpoints
#' shinyApp(fixedPage(ui), server)
#' # Container width is equal to the window's width
#' shinyApp(bootstrapPage(ui), server)
#' }
#'
#' # The default look is provided by Bootstrap 3, but {bslib} can be
#' # used to customize the Bootstrap version and its default styling
#' theme <- bslib::bs_theme(
#' version = 5,
#' bg = "#101010",
#' fg = "#FDF7F7",
#' primary = "#ED79F9",
#' base_font = bslib::font_google("Prompt"),
#' code_font = bslib::font_google("JetBrains Mono")
#' )
#' if (interactive()) {
#' # Call thematic::thematic_shiny(font = "auto") to automatically
#' # translate the theme/CSS to the R plot
#' shinyApp(
#' fluidPage(ui, theme = theme, title = "Hello Bootstrap 5"),
#' server
#' )
#' }
#'
bootstrapPage <- function(..., title = NULL, theme = NULL, lang = NULL) {
args <- list(
@@ -234,14 +282,12 @@ bootstrapDependency <- function(theme) {
bootstrapVersion <- "3.4.1"
#' @rdname bootstrapPage
#' @export
basicPage <- function(...) {
bootstrapPage(div(class="container-fluid", list(...)))
}
#' Create a page that fills the window
#'
#' `fillPage` creates a page whose height and width always fill the

View File

@@ -14,6 +14,7 @@ bootstrapLib(theme = NULL)
build of Bootstrap 3 with a customized version of Bootstrap 3 or higher.
\item A character string pointing to an alternative Bootstrap stylesheet
(normally a css file within the www directory, e.g. \code{www/bootstrap.css}).
This option is here mainly for legacy reasons.
}}
}
\description{

View File

@@ -1,18 +1,25 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bootstrap.R
\name{bootstrapPage}
% Please edit documentation in R/bootstrap-layout.R, R/bootstrap.R
\name{fluidPage}
\alias{fluidPage}
\alias{fixedPage}
\alias{bootstrapPage}
\alias{basicPage}
\title{Create a Bootstrap page}
\title{Create a Bootstrap UI page container}
\usage{
fluidPage(..., title = NULL, theme = NULL, lang = NULL)
fixedPage(..., title = NULL, theme = NULL, lang = NULL)
bootstrapPage(..., title = NULL, theme = NULL, lang = NULL)
basicPage(...)
}
\arguments{
\item{...}{The contents of the document body.}
\item{...}{UI elements (i.e., \link{tags}).}
\item{title}{The browser window title (defaults to the host URL of the page)}
\item{title}{The browser window title (defaults to the host URL of the page).
Can also be set as a side effect of the \code{\link[=titlePanel]{titlePanel()}} function.}
\item{theme}{One of the following:
\itemize{
@@ -21,30 +28,74 @@ basicPage(...)
build of Bootstrap 3 with a customized version of Bootstrap 3 or higher.
\item A character string pointing to an alternative Bootstrap stylesheet
(normally a css file within the www directory, e.g. \code{www/bootstrap.css}).
This option is here mainly for legacy reasons.
}}
\item{lang}{ISO 639-1 language code for the HTML page, such as "en" or "ko".
This will be used as the lang in the \code{<html>} tag, as in \code{<html lang="en">}.
This will be used as the lang in the \verb{<html>} tag, as in \verb{<html lang="en">}.
The default (NULL) results in an empty string.}
}
\value{
A UI defintion that can be passed to the \link{shinyUI} function.
A UI definition (i.e., a \link{tags} object) that can be passed to \code{\link[=shinyApp]{shinyApp()}}.
}
\description{
Create a Shiny UI page that loads the CSS and JavaScript for
\href{https://getbootstrap.com/}{Bootstrap}, and has no content in the page
body (other than what you provide).
Create a user interface (UI) page container based on
\href{https://getbootstrap.com/}{Bootstrap}'s CSS and JavaScript. Most Shiny apps
should use \code{\link[=fluidPage]{fluidPage()}} (or \code{\link[=navbarPage]{navbarPage()}}) to get a page container with a
responsive page width, but in some cases you may want a fixed width container
(\code{fixedPage()}) or just a bare \verb{<body>} container (\code{bootstrapPage()}).
Most Shiny apps make use of other Shiny UI functions for \href{https://shiny.rstudio.com/articles/layout-guide.html}{managing layout} (e.g.,
\code{\link[=sidebarLayout]{sidebarLayout()}}, \code{\link[=fluidRow]{fluidRow()}}, etc), navigation (e.g., \code{\link[=tabPanel]{tabPanel()}}), and
other styling (e.g., \code{\link[=wellPanel]{wellPanel()}}, \code{\link[=inputPanel]{inputPanel()}}). A good portion of these
Shiny UI functions require Bootstrap to work properly (so most Shiny apps
should use these functions to start their UI definitions), but more advanced
usage (i.e., custom HTML/CSS/JS) can avoid Bootstrap entirely by using
\code{\link[=htmlTemplate]{htmlTemplate()}} and/or HTML \link{tags}.
}
\details{
This function is primarily intended for users who are proficient in HTML/CSS,
and know how to lay out pages in Bootstrap. Most applications should use
\code{\link[=fluidPage]{fluidPage()}} along with layout functions like
\code{\link[=fluidRow]{fluidRow()}} and \code{\link[=sidebarLayout]{sidebarLayout()}}.
\examples{
# First create some UI content.
# See the layout guide to learn more about creating different layouts
# https://shiny.rstudio.com/articles/layout-guide.html
ui <- sidebarLayout(
sidebarPanel(sliderInput("obs", "Number of observations:", 0, 1000, 500)),
mainPanel(plotOutput("distPlot"))
)
server <- function(input, output) {
output$distPlot <- renderPlot(hist(rnorm(input$obs)))
}
\note{
The \code{basicPage} function is deprecated, you should use the
\code{\link[=fluidPage]{fluidPage()}} function instead.
# Demonstrating difference between fluidPage(), fixedPage(), bootstrapPage()
if (interactive()) {
# Container width scales _fluidly_ with window size
shinyApp(fluidPage(ui), server)
# Container width changes with window size at fixed breakpoints
shinyApp(fixedPage(ui), server)
# Container width is equal to the window's width
shinyApp(bootstrapPage(ui), server)
}
# The default look is provided by Bootstrap 3, but {bslib} can be
# used to customize the Bootstrap version and its default styling
theme <- bslib::bs_theme(
version = 5,
bg = "#101010",
fg = "#FDF7F7",
primary = "#ED79F9",
base_font = bslib::font_google("Prompt"),
code_font = bslib::font_google("JetBrains Mono")
)
if (interactive()) {
# Call thematic::thematic_shiny(font = "auto") to automatically
# translate the theme/CSS to the R plot
shinyApp(
fluidPage(ui, theme = theme, title = "Hello Bootstrap 5"),
server
)
}
}
\seealso{
\code{\link[=fluidPage]{fluidPage()}}, \code{\link[=fixedPage]{fixedPage()}}
\code{\link[=navbarPage]{navbarPage()}}, \code{\link[=fillPage]{fillPage()}}, \code{\link[=column]{column()}}, \code{\link[=tabPanel]{tabPanel()}}
}

View File

@@ -1,26 +1,45 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bootstrap-layout.R
\name{column}
\name{fluidRow}
\alias{fluidRow}
\alias{fixedRow}
\alias{column}
\title{Create a column within a UI definition}
\title{Responsive row-column based layout}
\usage{
fluidRow(...)
fixedRow(...)
column(width, ..., offset = 0)
}
\arguments{
\item{width}{The grid width of the column (must be between 1 and 12)}
\item{...}{UI elements (i.e., \link{tags}). For \code{fluidRow()}, \code{...} should be a set of \code{column()}s.}
\item{...}{Elements to include within the column}
\item{width}{The grid width of the column (must be between 1 and 12). When
the device width is small (e.g., the viewer is on a mobile phone), the
width is always 12. For more control over these responsive breakpoints, use
Bootstrap's grid system more directly (e.g., \code{fluidRow(div(class = "col-lg-2", ...))}).}
\item{offset}{The number of columns to offset this column from the end of the
previous column.}
}
\value{
A column that can be included within a
\code{\link[=fluidRow]{fluidRow()}} or \code{\link[=fixedRow]{fixedRow()}}.
A UI element (i.e., \link{tags}).
}
\description{
Create a column for use within a \code{\link[=fluidRow]{fluidRow()}} or
\code{\link[=fixedRow]{fixedRow()}}
Layout UI components using Bootstrap's grid layout system. Use
\code{fluidRow()} to group elements that should appear on the same line (if the
browser has adequate width) and \code{column()} to define how much horizontal
space within a 12-unit wide grid each on of these elements should occupy. See
the \href{https://shiny.rstudio.com/articles/layout-guide.html}{layout guide} for
more context and examples.
}
\details{
To work properly, these functions need \href{https://getbootstrap.com}{Bootstrap}
included on the page. Since most Shiny apps use \code{\link[=bootstrapPage]{bootstrapPage()}}
under-the-hood, this is usually the case, but custom page containers (i.e.,
\code{\link[=htmlTemplate]{htmlTemplate()}}) may need to explicitly include \code{\link[=bootstrapLib]{bootstrapLib()}}
dependencies.
}
\examples{
## Only run examples in interactive R sessions
@@ -46,21 +65,15 @@ server <- function(input, output) {
shinyApp(ui, server)
ui <- fluidPage(
fluidRow(
column(width = 4,
"4"
),
column(width = 3, offset = 2,
"3 offset 2"
)
column(width = 4, "4"),
column(width = 3, offset = 2, "3 offset 2")
)
)
shinyApp(ui, server = function(input, output) { })
}
}
\seealso{
\code{\link[=fluidRow]{fluidRow()}}, \code{\link[=fixedRow]{fixedRow()}}.
\code{\link[=fluidPage]{fluidPage()}}
}

View File

@@ -37,10 +37,11 @@ shown in the document).}
build of Bootstrap 3 with a customized version of Bootstrap 3 or higher.
\item A character string pointing to an alternative Bootstrap stylesheet
(normally a css file within the www directory, e.g. \code{www/bootstrap.css}).
This option is here mainly for legacy reasons.
}}
\item{lang}{ISO 639-1 language code for the HTML page, such as "en" or "ko".
This will be used as the lang in the \code{<html>} tag, as in \code{<html lang="en">}.
This will be used as the lang in the \verb{<html>} tag, as in \verb{<html lang="en">}.
The default (NULL) results in an empty string.}
}
\description{
@@ -101,9 +102,7 @@ fillPage(
}
\seealso{
Other layout functions:
\code{\link{fixedPage}()},
\code{\link{flowLayout}()},
\code{\link{fluidPage}()},
\code{\link{navbarPage}()},
\code{\link{sidebarLayout}()},
\code{\link{splitLayout}()},

View File

@@ -1,85 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bootstrap-layout.R
\name{fixedPage}
\alias{fixedPage}
\alias{fixedRow}
\title{Create a page with a fixed layout}
\usage{
fixedPage(..., title = NULL, theme = NULL, lang = NULL)
fixedRow(...)
}
\arguments{
\item{...}{Elements to include within the container}
\item{title}{The browser window title (defaults to the host URL of the page)}
\item{theme}{One of the following:
\itemize{
\item \code{NULL} (the default), which implies a "stock" build of Bootstrap 3.
\item A \code{\link[bslib:bs_theme]{bslib::bs_theme()}} object. This can be used to replace a stock
build of Bootstrap 3 with a customized version of Bootstrap 3 or higher.
\item A character string pointing to an alternative Bootstrap stylesheet
(normally a css file within the www directory, e.g. \code{www/bootstrap.css}).
}}
\item{lang}{ISO 639-1 language code for the HTML page, such as "en" or "ko".
This will be used as the lang in the \code{<html>} tag, as in \code{<html lang="en">}.
The default (NULL) results in an empty string.}
}
\value{
A UI defintion that can be passed to the \link{shinyUI} function.
}
\description{
Functions for creating fixed page layouts. A fixed page layout consists of
rows which in turn include columns. Rows exist for the purpose of making sure
their elements appear on the same line (if the browser has adequate width).
Columns exist for the purpose of defining how much horizontal space within a
12-unit wide grid it's elements should occupy. Fixed pages limit their width
to 940 pixels on a typical display, and 724px or 1170px on smaller and larger
displays respectively.
}
\details{
To create a fixed page use the \code{fixedPage} function and include
instances of \code{fixedRow} and \code{\link[=column]{column()}} within it. Note that
unlike \code{\link[=fluidPage]{fluidPage()}}, fixed pages cannot make use of higher-level
layout functions like \code{sidebarLayout}, rather, all layout must be done
with \code{fixedRow} and \code{column}.
}
\note{
See the \href{https://shiny.rstudio.com/articles/layout-guide.html}{ Shiny Application Layout Guide} for additional details on laying out fixed
pages.
}
\examples{
## Only run examples in interactive R sessions
if (interactive()) {
ui <- fixedPage(
title = "Hello, Shiny!",
fixedRow(
column(width = 4,
"4"
),
column(width = 3, offset = 2,
"3 offset 2"
)
)
)
shinyApp(ui, server = function(input, output) { })
}
}
\seealso{
\code{\link[=column]{column()}}
Other layout functions:
\code{\link{fillPage}()},
\code{\link{flowLayout}()},
\code{\link{fluidPage}()},
\code{\link{navbarPage}()},
\code{\link{sidebarLayout}()},
\code{\link{splitLayout}()},
\code{\link{verticalLayout}()}
}
\concept{layout functions}

View File

@@ -34,8 +34,6 @@ shinyApp(ui, server = function(input, output) { })
\seealso{
Other layout functions:
\code{\link{fillPage}()},
\code{\link{fixedPage}()},
\code{\link{fluidPage}()},
\code{\link{navbarPage}()},
\code{\link{sidebarLayout}()},
\code{\link{splitLayout}()},

View File

@@ -1,119 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bootstrap-layout.R
\name{fluidPage}
\alias{fluidPage}
\alias{fluidRow}
\title{Create a page with fluid layout}
\usage{
fluidPage(..., title = NULL, theme = NULL, lang = NULL)
fluidRow(...)
}
\arguments{
\item{...}{Elements to include within the page}
\item{title}{The browser window title (defaults to the host URL of the page).
Can also be set as a side effect of the \code{\link[=titlePanel]{titlePanel()}} function.}
\item{theme}{One of the following:
\itemize{
\item \code{NULL} (the default), which implies a "stock" build of Bootstrap 3.
\item A \code{\link[bslib:bs_theme]{bslib::bs_theme()}} object. This can be used to replace a stock
build of Bootstrap 3 with a customized version of Bootstrap 3 or higher.
\item A character string pointing to an alternative Bootstrap stylesheet
(normally a css file within the www directory, e.g. \code{www/bootstrap.css}).
}}
\item{lang}{ISO 639-1 language code for the HTML page, such as "en" or "ko".
This will be used as the lang in the \code{<html>} tag, as in \code{<html lang="en">}.
The default (NULL) results in an empty string.}
}
\value{
A UI defintion that can be passed to the \link{shinyUI} function.
}
\description{
Functions for creating fluid page layouts. A fluid page layout consists of
rows which in turn include columns. Rows exist for the purpose of making sure
their elements appear on the same line (if the browser has adequate width).
Columns exist for the purpose of defining how much horizontal space within a
12-unit wide grid it's elements should occupy. Fluid pages scale their
components in realtime to fill all available browser width.
}
\details{
To create a fluid page use the \code{fluidPage} function and include
instances of \code{fluidRow} and \code{\link[=column]{column()}} within it. As an
alternative to low-level row and column functions you can also use
higher-level layout functions like \code{\link[=sidebarLayout]{sidebarLayout()}}.
}
\note{
See the \href{https://shiny.rstudio.com/articles/layout-guide.html}{ Shiny-Application-Layout-Guide} for additional details on laying out fluid
pages.
}
\examples{
## Only run examples in interactive R sessions
if (interactive()) {
# Example of UI with fluidPage
ui <- fluidPage(
# Application title
titlePanel("Hello Shiny!"),
sidebarLayout(
# Sidebar with a slider input
sidebarPanel(
sliderInput("obs",
"Number of observations:",
min = 0,
max = 1000,
value = 500)
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot")
)
)
)
# Server logic
server <- function(input, output) {
output$distPlot <- renderPlot({
hist(rnorm(input$obs))
})
}
# Complete app with UI and server components
shinyApp(ui, server)
# UI demonstrating column layouts
ui <- fluidPage(
title = "Hello Shiny!",
fluidRow(
column(width = 4,
"4"
),
column(width = 3, offset = 2,
"3 offset 2"
)
)
)
shinyApp(ui, server = function(input, output) { })
}
}
\seealso{
\code{\link[=column]{column()}}
Other layout functions:
\code{\link{fillPage}()},
\code{\link{fixedPage}()},
\code{\link{flowLayout}()},
\code{\link{navbarPage}()},
\code{\link{sidebarLayout}()},
\code{\link{splitLayout}()},
\code{\link{verticalLayout}()}
}
\concept{layout functions}

View File

@@ -71,6 +71,7 @@ layout.}
build of Bootstrap 3 with a customized version of Bootstrap 3 or higher.
\item A character string pointing to an alternative Bootstrap stylesheet
(normally a css file within the www directory, e.g. \code{www/bootstrap.css}).
This option is here mainly for legacy reasons.
}}
\item{windowTitle}{the browser window title (as a character string). The
@@ -79,7 +80,7 @@ default value, \code{NA}, means to use any character strings that appear in
default).}
\item{lang}{ISO 639-1 language code for the HTML page, such as "en" or "ko".
This will be used as the lang in the \code{<html>} tag, as in \code{<html lang="en">}.
This will be used as the lang in the \verb{<html>} tag, as in \verb{<html lang="en">}.
The default (NULL) results in an empty string.}
\item{menuName}{A name that identifies this \code{navbarMenu}. This
@@ -124,9 +125,7 @@ navbarPage("App Title",
Other layout functions:
\code{\link{fillPage}()},
\code{\link{fixedPage}()},
\code{\link{flowLayout}()},
\code{\link{fluidPage}()},
\code{\link{sidebarLayout}()},
\code{\link{splitLayout}()},
\code{\link{verticalLayout}()}

View File

@@ -83,9 +83,7 @@ shinyApp(ui, server)
\seealso{
Other layout functions:
\code{\link{fillPage}()},
\code{\link{fixedPage}()},
\code{\link{flowLayout}()},
\code{\link{fluidPage}()},
\code{\link{navbarPage}()},
\code{\link{splitLayout}()},
\code{\link{verticalLayout}()}

View File

@@ -64,9 +64,7 @@ shinyApp(ui, server)
\seealso{
Other layout functions:
\code{\link{fillPage}()},
\code{\link{fixedPage}()},
\code{\link{flowLayout}()},
\code{\link{fluidPage}()},
\code{\link{navbarPage}()},
\code{\link{sidebarLayout}()},
\code{\link{verticalLayout}()}

View File

@@ -33,9 +33,7 @@ shinyApp(ui, server = function(input, output) { })
\seealso{
Other layout functions:
\code{\link{fillPage}()},
\code{\link{fixedPage}()},
\code{\link{flowLayout}()},
\code{\link{fluidPage}()},
\code{\link{navbarPage}()},
\code{\link{sidebarLayout}()},
\code{\link{splitLayout}()}

View File

@@ -9,108 +9,111 @@ template:
# NOTE: These templates live in shiny-dev-center
path: _pkgdown_templates
reference:
- title: UI Layout
desc: Functions for laying out the user interface for your application.
- title: Page containers
desc: Create a user interface page container.
contents:
- absolutePanel
- bootstrapPage
- column
- conditionalPanel
- fillPage
- fillRow
- fixedPage
- fluidPage
- helpText
- icon
- navbarPage
- navlistPanel
- fillPage
- htmlTemplate
- title: UI layout
desc: Control the layout of multiple UI components.
contents:
- column
- fillRow
- sidebarLayout
- tabPanel
- tabsetPanel
- titlePanel
- inputPanel
- flowLayout
- splitLayout
- verticalLayout
- wellPanel
- withMathJax
- title: UI Inputs
desc: Functions for creating user interface elements that prompt the user for input values or interaction.
desc: Create UI that prompts the user for input values or interaction.
contents:
- actionButton
- checkboxGroupInput
- checkboxInput
- dateInput
- dateRangeInput
- fileInput
- numericInput
- radioButtons
- selectInput
- varSelectInput
- sliderInput
- submitButton
- dateInput
- dateRangeInput
- checkboxInput
- checkboxGroupInput
- radioButtons
- numericInput
- textInput
- textAreaInput
- passwordInput
- updateActionButton
- updateCheckboxGroupInput
- updateCheckboxInput
- updateDateInput
- updateDateRangeInput
- updateNumericInput
- updateRadioButtons
- actionButton
- getQueryString
- submitButton
- title: Update inputs
desc: Programmatically update input values
contents:
- updateSelectInput
- updateSliderInput
- updateDateInput
- updateDateRangeInput
- updateCheckboxInput
- updateCheckboxGroupInput
- updateRadioButtons
- updateNumericInput
- updateTextInput
- updateTextAreaInput
- updateActionButton
- updateQueryString
- title: Navigation (tab) panels
desc: Create segments of UI content.
contents:
- navbarPage
- tabPanel
- tabsetPanel
- navlistPanel
- updateTabsetPanel
- insertTab
- showTab
- updateTextInput
- updateTextAreaInput
- updateQueryString
- getQueryString
- title: UI Outputs
desc: Functions for creating user interface elements that, in conjunction with rendering functions, display different kinds of output from your application.
- title: UI panels
desc: Visually group together a section of UI components.
contents:
- htmlOutput
- plotOutput
- outputOptions
- textOutput
- absolutePanel
- conditionalPanel
- titlePanel
- inputPanel
- wellPanel
- title: Uploads & downloads
desc: Allows users to upload and download files.
contents:
- fileInput
- downloadButton
- Progress
- withProgress
- modalDialog
- urlModal
- showModal
- showNotification
- title: Interface builder functions
desc: A sub-library for writing HTML using R functions. These functions form the foundation on which the higher level user interface functions are built, and can also be used in your Shiny UI to provide custom HTML, CSS, and JavaScript.
- downloadHandler
- title: Custom UI
desc: Lower-level UI functions for creating custom HTML/CSS/JS.
contents:
- icon
- markdown
- helpText
- withMathJax
- builder
- HTML
- include
- singleton
- tagList
- insertUI
- include
- tagAppendAttributes
- tagAppendChild
- validateCssUnit
- withTags
- htmlTemplate
- bootstrapLib
- suppressDependencies
- insertUI
- markdown
- title: Rendering functions
desc: Functions that you use in your application's server side code, assigning them to outputs that appear in your user interface.
- singleton
- title: Rendering outputs
desc: UI (`*Output()`) and server (`render*()`) functions for generating content server-side.
contents:
- plotOutput
- renderPlot
- renderCachedPlot
- renderPrint
- renderDataTable
- renderImage
- renderTable
- textOutput
- renderPrint
- htmlOutput
- renderUI
- downloadHandler
- createRenderFunction
- renderDataTable
- renderTable
- outputOptions
- title: Reactive programming
desc: A sub-library that provides reactive programming facilities for R.
contents:
@@ -132,87 +135,101 @@ reference:
- reactiveTimer
- domains
- freezeReactiveValue
- title: Running
desc: Functions that are used to run or stop Shiny applications.
- title: Caching
desc: Make apps more responsive by setting up a persistent cache.
contents:
- bindCache
- renderCachedPlot
- sizeGrowthRatio
- title: Create and run applications
desc: Create, run, stop, and hook into the lifecycle of Shiny applications.
contents:
- shinyApp
- runApp
- runGadget
- runExample
- runGadget
- runUrl
- stopApp
- onStop
- onFlush
- viewer
- isRunning
- loadSupport
- title: Bookmarking state
desc: Functions that are used for bookmarking and restoring state.
- title: Display messages
desc: Display messages to the user.
contents:
- helpText
- showNotification
- Progress
- withProgress
- modalDialog
- showModal
- urlModal
- title: Modules
desc: Control application complexity by namespacing UI and server code.
contents:
- moduleServer
- NS
- callModule
- title: Error validation
desc: Control how errors are shown to the user.
contents:
- req
- isTruthy
- validate
- safeError
- title: Bookmarking
desc: Bookmark and restore application state.
contents:
- bookmarkButton
- enableBookmarking
- setBookmarkExclude
- showBookmarkUrlModal
- onBookmark
- setSerializer
- restoreInput
- title: Static plot interaction
desc: Control the experience of interacting with static plots.
contents:
- brushedPoints
- brushOpts
- clickOpts
- title: Testing
desc: Test apps with and/or without a headless browser (shinytest).
contents:
- runTests
- testServer
- MockShinySession
- snapshotExclude
- snapshotPreprocessInput
- snapshotPreprocessOutput
- exportTestValues
- applyInputHandlers
- title: Utility functions
desc: Various utilities for advanced users.
contents:
- session
- shinyOptions
- serverInfo
- getCurrentOutputInfo
- httpResponse
- devmode
- shinyAppTemplate
- parseQueryString
- plotPNG
- repeatable
- key_missing
- maskReactiveContext
- title: Extending Shiny
desc: Functions that are intended to be called by third-party packages that extend Shiny.
desc: Various utilities for 3rd party packages that extend Shiny.
contents:
- createWebDependency
- resourcePaths
- registerInputHandler
- removeInputHandler
- markRenderFunction
- title: Utility functions
desc: Miscellaneous utilities that may be useful to advanced users or when extending Shiny.
contents:
- devmode
- shinyAppTemplate
- req
- isTruthy
- validate
- session
- shinyOptions
- safeError
- onFlush
- restoreInput
- applyInputHandlers
- parseQueryString
- getCurrentOutputInfo
- plotPNG
- sizeGrowthRatio
- exportTestValues
- setSerializer
- snapshotExclude
- snapshotPreprocessInput
- snapshotPreprocessOutput
- repeatable
- serverInfo
- onStop
- httpResponse
- key_missing
- title: Plot interaction
desc: Functions related to interactive plots
contents:
- brushedPoints
- brushOpts
- clickOpts
- title: Modules
desc: Functions for modularizing Shiny apps
contents:
- NS
- moduleServer
- callModule
- title: Embedding
desc: Functions that are intended for third-party packages that embed Shiny applications.
contents:
- shinyApp
- maskReactiveContext
- title: Testing
desc: Functions intended for testing of Shiny components
contents:
- runTests
- testServer
- MockShinySession
- createRenderFunction
- title: Superseded
desc: Functions that have been `r lifecycle::badge("superseded")`
desc: Functions that have been `r lifecycle::badge("superseded")`.
contents:
- markRenderFunction
- shinyUI