Description Usage Arguments Value Note Examples
Alternate the text in the browser tab between the current text and the new specified text.
1 2 3 4 5 6 7 8 9 | flashing_window_title(
session = shiny::getDefaultReactiveDomain(),
title = "Ready!",
inactive_only = FALSE,
revert_on_focus = inactive_only,
revert_on_mousemove = TRUE,
interval = 500,
duration = 0
)
|
session |
The |
title |
String to give the window title. |
inactive_only |
Logical, whether or not the title should only change if the tab is not
active. Default is set to |
revert_on_focus |
Logical, should the title revert back to the original title when the tab is in
focus/active again? Only works when |
revert_on_mousemove |
Logical, should the title revert back to the original title when the mouse
is moved in the tab? Default is set to |
interval |
Time (in milliseconds) to flip between the original title and the new title. |
duration |
Time (in milliseconds) to stop flashing the title. 0 (the default) means it will flash indefinitely. |
The browser tab title will change between the original and newly specified title.
Add use_shiny_title
within the UI for flashing_window_title
to work.
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 | if (interactive()) {
library(shiny)
ui <- fluidPage(
title = "Initial Title",
use_shiny_title(),
actionButton("button", "Click me for a 10 second flashing title"),
actionButton("button2", "Click me for a delayed flashing button")
)
server <- function(input, output, session) {
observeEvent(input$button, {
flashing_window_title(
session, "--- Flash ---", revert_on_mousemove = FALSE, duration = 10000
)
})
observeEvent(input$button2, {
Sys.sleep(3)
flashing_window_title(
session, "Please Come Back", inactive_only = TRUE, interval = 1000
)
})
}
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.