Description Usage Arguments See Also Examples
View source: R/bookmark-state.R
A bookmarkButton
is a actionButton
with a default label
that consists of a link icon and the text "Bookmark...". It is meant to be
used for bookmarking state.
1 2 3 4 |
label |
The contents of the button or linkâusually a text label, but you could also use any other HTML, like an image. |
icon |
An optional |
title |
A tooltip that is shown when the mouse cursor hovers over the button. |
... |
Named attributes to be applied to the button or link. |
id |
An ID for the bookmark button. The only time it is necessary to set
the ID unless you have more than one bookmark button in your application.
If you specify an input ID, it should be excluded from bookmarking with
|
enableBookmarking
for more examples.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ## Only run these examples in interactive sessions
if (interactive()) {
# This example shows how to use multiple bookmark buttons. If you only need
# a single bookmark button, see examples in ?enableBookmarking.
ui <- function(request) {
fluidPage(
tabsetPanel(id = "tabs",
tabPanel("One",
checkboxInput("chk1", "Checkbox 1"),
bookmarkButton(id = "bookmark1")
),
tabPanel("Two",
checkboxInput("chk2", "Checkbox 2"),
bookmarkButton(id = "bookmark2")
)
)
)
}
server <- function(input, output, session) {
# Need to exclude the buttons from themselves being bookmarked
setBookmarkExclude(c("bookmark1", "bookmark2"))
# Trigger bookmarking with either button
observeEvent(input$bookmark1, {
session$doBookmark()
})
observeEvent(input$bookmark2, {
session$doBookmark()
})
}
enableBookmarking(store = "url")
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.