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, be sure to make your UI a function as described in the details section of shiny::enableBookmarking(). It should take request as a parameter, though it shouldn’t be used in any way in the function body.

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

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