UI Output — renderUI

v1.7.2|Source: R/shinywrappers.R

Description

Renders reactive HTML using the Shiny UI library.

renderUI(expr, env = parent.frame(), quoted = FALSE, outputArgs = list())

Arguments

expr

An expression that returns a Shiny tag object, HTML(), or a list of such objects.

env

The parent environment for the reactive expression. By default, this is the calling environment, the same as when defining an ordinary non-reactive expression. If expr is a quosure and quoted is TRUE, then env is ignored.

quoted

If it is TRUE, then the quote()ed value of expr will be used when expr is evaluated. If expr is a quosure and you would like to use its expression as a value for expr, then you must set quoted to TRUE.

outputArgs

A list of arguments to be passed through to the implicit call to uiOutput() when renderUI is used in an interactive R Markdown document.

Details

The corresponding HTML output tag should be div and have the CSS class name shiny-html-output (or use uiOutput()).

See also

Examples

## Only run examples in interactive R sessions
if (interactive()) {

ui <- fluidPage(
  uiOutput("moreControls")
)

server <- function(input, output) {
  output$moreControls <- renderUI({
    tagList(
      sliderInput("n", "N", 1, 1000, 500),
      textInput("label", "Label")
    )
  })
}
shinyApp(ui, server)
}