centred_row: Create a Shiny fluidRow with centred content This is a...

View source: R/centred_row.R

centred_rowR Documentation

Create a Shiny fluidRow with centred content This is a convenience function intended for use in Shiny apps where you want content centred, surrounded to left and white by whitespace, using shiny::fluidRow() and shiny::column().

Description

Create a Shiny fluidRow with centred content This is a convenience function intended for use in Shiny apps where you want content centred, surrounded to left and white by whitespace, using shiny::fluidRow() and shiny::column().

Usage

centred_row(
  content,
  left_content = NULL,
  right_content = NULL,
  left_space = 2,
  right_space = left_space,
  max_width_px = 1140,
  ...
)

Arguments

content

The content you wish to place in the main (middle) column of the row, such as plotOutput("plot"). Use shiny::tagList() to supply multiple items.

left_content

The content to be placed in the left hand column. NULL by default, which means the column will be whitespace.

right_content

The content to be placed in the right hand column. NULL by default, which means the column will be whitespace.

left_space

Numeric. Default is 2. Must be between 1 and 10 (inclusive). See Details.

right_space

Numeric. Default is equal to left_space. Must be between 1 and 10 (inclusive). See Details.

max_width_px

Maximum width of content, in pixels.

...

Additional elements passed to main column. Can be used for attributes such as id.

Details

This function creates a shiny::fluidRow() then divides that row into three columns. The left and right columns are whitespace. The content goes in the centre column. Any space not allocated to the left or right space is left for the content.

Units of measurement for left_space and right_space are based on the Bootstrap 12-wide grid system. A value of 2 therefore means that a column will take up 1/6th of the horizontal space on the page.

The total width of each column must be at least 1. The total width of the three columns must be equal to 12. Each column therefore cannot be greater than 10 width.

Value

a shiny.tag object that creates a three-column fluidRow.

Examples


centred_row(shiny::plotOutput("plot1"))

djpr-data/djprshiny documentation built on May 14, 2023, 1:15 p.m.