Interactive Documents

This page describes the types of documents that make use of interactive code execution in Connect. Interactive code execution means that Connect manages an active Python or R process to support interactive elements. In this respect, interactive documents are similar to applications and API frameworks and processes can be scaled to meet the demands of your users.

Not all content with user interactivity requires interactive (server-side) code execution. Frameworks like Observable and htmlwidgets can be used to provide basic client-side interactivity using JavaScript that executes in the viewer’s browser rather than on the server. Jupyter widgets are another popular framework in this category, however they are currently only supported in Connect through the ipywidgets package and Voilà, which runs in interactive mode.

Voilà

By default, Connect renders Jupyter Notebook files into HTML documents. If your notebook includes interactive widgets (ipywidgets), deploy using Voilà mode to present the notebook interactively using Voilà.

Interactive mode runs the notebook each time a user visits it, and maintains a live Jupyter kernel so that the user can interact with your code via interactive widgets.

You can run your notebook locally using Voilà from the command line (voila notebook.ipynb) or via the Voilà extension for Jupyter. Running your notebook locally is helpful to identify issues before deploying.

Note

While Connect supports Voilà content, other frameworks built off of Voilà may not work with Connect.

Shiny R Markdown

Shiny R Markdown was introduced as an alternative way to build Shiny applications in R. You can use Shiny widgets and outputs in R Markdown to create interactive reports or slideshows. The resulting document is a complete Shiny app.

You can make an R Markdown document interactive in two steps:

  1. add runtime: shiny to the YAML header
  2. add Shiny widgets and Shiny render functions to the R code chunks

The rmarkdown package compiles your document into a reactive Shiny app.

Reactive output can also be included in your documents by using render* functions. R Markdown includes the rendered output in the result of the code chunk. The output then behaves like rendered output in a standard Shiny app, and automatically updates whenever you change a widget value or reactive expression that it depends on.

For more information on creating interactive documents using Shiny, see the Interactive Docs Shiny article.

Quarto

Quarto supports server-side and client-side interactive content through various technologies, making it a powerful option for many different types of use cases.

Connect supports most Quarto interactive capabilities:

Quarto support Type of interactivity Connect execution mode
Interactives written with Shiny Server-side Interactive
R htmlwidgets Client-side Non-interactive
ObservableJS for JavaScript-powered interactive visualizations Client-side Non-interactive
Note

Connect does not support running interactives written with Jupyter widgets in Quarto documents. As an alternative, see Voilà.

For more information on the interactive features of Quarto and how they are supported in Connect, see the Quarto section of the guide.