Skip to contents

To use Shiny bookmarking, call shiny::enableBookmarking() somewhere in your main.R:

box::use(
  shiny,
)

shiny$enableBookmarking()

#' @export
ui <- function(id) {
  ns <- shiny$NS(id)
  shiny$bootstrapPage(
    shiny$bookmarkButton(),
    shiny$textInput(ns("name"), "Name"),
    shiny$textOutput(ns("message"))
  )
}

#' @export
server <- function(id) {
  shiny$moduleServer(id, function(input, output, session) {
    output$message <- shiny$renderText(paste0("Hello ", input$name, "!"))
  })
}

If you are using a legacy entrypoint, make sure that your UI is a function as described in the details section of shiny::enableBookmarking().

For example, with legacy_entrypoint: source in rhino.yml you might use:

ui <- function(request) {
  bootstrapPage(
    bookmarkButton(),
    textField("text", "Text")
  )
}