Shinylive Setup & Deployment
Installation
- From CRAN:
install.packages("shinylive")- From GitHub (recommended):
pak::pak("posit-dev/r-shinylive")Check installed version:
shinylive::assets_info()Export & Preview Shinylive App
Export your Shiny app as a Shinylive static webpage:
shinylive::export("myapp", "site")Preview locally:
httpuv::runStaticServer("site")Creating a Basic Shinylive App
Example: Hello Shiny
Create app.R:
library(shiny)
ui <- fluidPage(
sliderInput("bins", "Number of bins:", 1, 50, 30),
plotOutput("distPlot")
)
server <- function(input, output) {
output$distPlot <- renderPlot({
x <- faithful$waiting
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = "skyblue", border = "white")
})
}
shinyApp(ui, server)Export and preview:
shinylive::export(".", "site")
httpuv::runStaticServer("site")Embedding Shinylive in Quarto Documents
Install Quarto extension
quarto add quarto-ext/shinyliveEnable in YAML header:
---
filters:
- shinylive
---Embed app directly in Quarto
```{shinylive-r}
#| standalone: true
library(shiny)
ui <- fluidPage(
sliderInput("bins", "Number of bins:", 1, 50, 30),
plotOutput("distPlot")
)
server <- function(input, output) {
output$distPlot <- renderPlot({
hist(faithful$waiting, breaks = input$bins)
})
}
shinyApp(ui, server)
```#| '!! shinylive warning !!': |
#| shinylive does not work in self-contained HTML documents.
#| Please set `embed-resources: false` in your metadata.
#| standalone: true
#| viewerHeight: 650
library(shiny)
ui <- fluidPage(
sliderInput("bins", "Number of bins:", 1, 50, 30),
plotOutput("distPlot")
)
server <- function(input, output) {
output$distPlot <- renderPlot({
hist(faithful$waiting, breaks = input$bins)
})
}
shinyApp(ui, server)
Troubleshooting & Customization Tips
Common Issues
- Missing packages:
- Add hidden package installation:
if (FALSE) {
library(hidden_package)
}- Slow startup:
- Limit app dependencies for faster loading.
- Assets management:
Check local cache:
shinylive::assets_info()Clean old assets:
shinylive::assets_cleanup()Multiple Apps
Export multiple apps efficiently:
shinylive::export("myapp1", "site", subdir = "app1")
shinylive::export("myapp2", "site", subdir = "app2")Serve multiple apps:
httpuv::runStaticServer("site")Further Reading
Explore More Articles
Note
Here are more articles from the same category to help you dive deeper into the topic.
No matching items
Reuse
Citation
BibTeX citation:
@online{kassambara2025,
author = {Kassambara, Alboukadel},
title = {Shinylive {Essentials} for {R} - {Cheatsheet}},
date = {2025-03-22},
url = {https://www.datanovia.com/learn/interactive/cheatsheets/shinylive-essentials-r.html},
langid = {en}
}
For attribution, please cite this work as:
Kassambara, Alboukadel. 2025. “Shinylive Essentials for R -
Cheatsheet.” March 22, 2025. https://www.datanovia.com/learn/interactive/cheatsheets/shinylive-essentials-r.html.
