Download PDF
Translations (PDF)
A Shiny app is a web page (ui) connected to a computer running a live R session (server).
Users can manipulate the UI, which will cause the server to update the UI’s displays (by running R code).
Create *Input() UI elements and read them with input$<id>. Match *Output() elements with render*() functions.
Save shinyApp() to app.R. Keep your app in a directory along with optional supporting code, images, etc.
Launch an app.R with runApp("path/to/app-name").
Get inspiration and examples from shiny.posit.co/r/gallery, shinylive.io/r/examples, or by running runExample() in the R console.
Build with AI assistance at gallery.shinyapps.io/assistant.
Share your app in four ways:
Host it on Posit Connect Cloud, a cloud based service from Posit. To deploy Shiny apps:
Purchase Posit Connect, a publishing platform for R and Python. posit.co/connect
Host your own Shiny Server. posit.co/products/open-source/shinyserver
Export to Shinylive, a technology for running apps entirely in the browser. posit-dev.github.io/r-shinylive
Shinylive apps use WebAssembly to run entirely in a browser—no need for a server to run R.
shinylive::export("app-name", "site"). Then deploy to a hosting site like Github or Netlify.To embed a Shinylive app in a Quarto doc, include the below syntax.
Reactively render R output. Match a render*() function to its corresponding *Output() function.
render*() Functions |
*Output() Functions |
|---|---|
renderPlot(expr, …) |
plotOutput(id, width, height, …) |
renderTable(expr, striped, …) |
tableOutput(id, …) |
renderPrint(expr, …) |
verbatimTextOutput(id, …) |
renderText(expr, …) |
textOutput(id, …) |
renderUI(expr, …) |
uiOutput(id, …) |
renderImage(expr, …) |
imageOutput(id, …) |
See the output gallery at shiny.posit.co/r/components.
More from the htmlwidgets.org ecosystem:
renderLeaflet(expr, …) with leafletOutput(id, …)renderPlotly(expr, …) with plotlyOutput(id, …)Collect values from the user.
Access the current value of an input object with input$<id>. Input values are reactive.
actionButton(id, label, ...)
actionLink(id, label, ...)
checkboxGroupInput(id, label, choices, selected, ...)
checkboxInput(id, label, value, ...)
dateInput(id, label, value, ...)
dateRangeInput(id, label, start, end, ...)
fileInput(id, label, ...)
numericInput(id, label, value, ...)
radioButtons(id, label, choices, selected, ...)
selectInput(id, label, choices, selected, multiple, ...). Also selectizeInput()
sliderInput(id, label, min, max, value, ...)
textInput(id, label, value, ...). Also textAreaInput()
More from the bslib package:
input_dark_mode(id, mode)
input_switch(id, label, value, ...)
input_task_button(id, label, value, ...)
See the input gallery at shiny.posit.co/r/components.
Reactive values work together with reactive functions. Call a reactive value from within the arguments of one of these functions to avoid the error Operation not allowed without an active reactive context.

reactiveValues()reactiveFileReader()reactivePoll()*Input()observeEvent()observe()invalidateLater()reactive()isolate()eventReactive()render*()*Input() functions: Create a reactive value input$<id> from user input.
reactiveVal(value): Create a reactive value from a given value. Useful for managing state.
reactive(x):
Calculate a (reactive) value based on other reactive values. Useful for encapsulating reactive logic needed across multiple outputs.
Call the expression with function syntax, e.g. re().
eventReactive(eventExpr, valueExpr): Creates reactive expression with code in 2nd argument that only invalidates when reactive values in 1st argument change.
render*() functions:
Produces results for a corresponding *Output() UI container. Re-render occurs when reactive dependencies change.
Save the results to output$<id>.
observe(x): Observe changes to reactive values.
observeEvent(eventExpr, handlerExpr): Runs code in 2nd argument when 1st argument changes.
isolate(expr): Prevent reactive values from invalidating a reactive expression.
Design delightful UI with the bslib package. It provides layouts, components, themes, & more.
page_sidebar() - Screen-filling sidebar layout
page_fillable() - Screen-filling page layout
page_fixed() - Constrained width page
page_fluid() - Basic full-width page
page_navbar() - Multi-page app with a top nav bar
layout_columns() - Bootstrap’s 12-column grid
layout_column_wrap() - Equal-width columns
layout_sidebar() - Resizable 2-column layout
Navigate a set of nav_panel()s in various ways with navset_card_*.
Visually group UI elements together with the card() component.
Tip: place within sidebar() to group similar inputs.
Choose from over a dozen pre-packaged themes with the bslib package to customize how your app looks and behaves.
Quickly change main colors and fonts by customizing individual arguments. Change in real-time by adding bs_themer() to your UI.
Shiny UI is powered by HTML, CSS, and JS. If you know these web technologies, you can customize UI to your heart’s content. Start small by modifying/authoring HTML and including CSS/JS snippets. Or, go fully custom with htmlTemplate().
Add HTML elements with tags, a list of functions that parallel common HTML tags, e.g. tags$a(). Unnamed arguments are treated as children and named arguments become HTML attributes.
To include a CSS file, use includeCSS(), or
Place the file in the www subdirectory
Link to it with:
To include JS, use includeScript(), or
Place the file in the www subdirectory
Link to it with:
To include an image:
Place the file in the www subdirectory
Link to it with img(src = "<file name>").
CC BY SA Posit Software, PBC • info@posit.co • posit.co
Learn more at shiny.posit.co
Updated: 2026-08.