Shiny Live demo

This document shows how to create interactive code chunks in a Quarto document.

Read more in the full blog post!

library(shiny)

# Define the UI
ui <- fluidPage(
  titlePanel("Shinylive Demo"),
  
  sidebarLayout(
    sidebarPanel(
      sliderInput("num",
                  "Choose a number:",
                  min = 1,
                  max = 100,
                  value = 25)
    ),
    
    mainPanel(
      textOutput("result")
    )
  )
)

# Define server logic
server <- function(input, output) {
  output$result <- renderText({
    paste("The chosen number is:", input$num)
  })
}

# Run the application
shinyApp(ui = ui, server = server)