Shiny
You can create interactive Quarto documents using Shiny. To do so:
- Add
server: shinyto 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_inputin the first code chunk. - The value of this widget is stored in
output$radio_output(which is in a code chunk withcontext: server, which is not visible in the rendered document). - The output element called
radio_outputis displayed using theverbatimTextOutputin 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: