How-to: Enable Shiny bookmarking
Source:vignettes/how-to/enable-shiny-bookmarking.Rmd
enable-shiny-bookmarking.RmdTo 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().