Shiny

interactivity
shiny
Author

Mine Çetinkaya-Rundel

Published

July 19, 2022

Shiny

You can create interactive Quarto documents using Shiny. To do so:

  • Add server: shiny to the YAML of your document.
  • Define Shiny UI elements in plain R code chunks.
  • Place Shiny server code in R code chunks with the chunk option context: server.

Below is an example of a Quarto document with Shiny elements in it. Click on a different radio button to see the effect in the document.

You can also click on the </> Code link in the document to view the source code for the document.

You’ll see that:

  • We create an input widget called radio_input in the first code chunk.
  • The value of this widget is stored in output$radio_output (which is in a code chunk with context: server, which is not visible in the rendered document).
  • The output element called radio_output is displayed using the verbatimTextOutput in the last code chunk.

This document is then deployed to shinyapps.io. You can find the standalone document at https://minecr.shinyapps.io/shiny_in_quarto.

Interactivity

In addition to Shiny, you can add interactivity to your Quarto documents with:

Learn more

Interactivity