EVOLUTION-MANAGER
Edit File: showNotification.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Show or remove a notification</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for showNotification {shiny}"><tr><td>showNotification {shiny}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Show or remove a notification</h2> <h3>Description</h3> <p>These functions show and remove notifications in a Shiny application. </p> <h3>Usage</h3> <pre> showNotification( ui, action = NULL, duration = 5, closeButton = TRUE, id = NULL, type = c("default", "message", "warning", "error"), session = getDefaultReactiveDomain() ) removeNotification(id, session = getDefaultReactiveDomain()) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>ui</code></td> <td> <p>Content of message.</p> </td></tr> <tr valign="top"><td><code>action</code></td> <td> <p>Message content that represents an action. For example, this could be a link that the user can click on. This is separate from <code>ui</code> so customized layouts can handle the main notification content separately from action content.</p> </td></tr> <tr valign="top"><td><code>duration</code></td> <td> <p>Number of seconds to display the message before it disappears. Use <code>NULL</code> to make the message not automatically disappear.</p> </td></tr> <tr valign="top"><td><code>closeButton</code></td> <td> <p>If <code>TRUE</code>, display a button which will make the notification disappear when clicked. If <code>FALSE</code> do not display.</p> </td></tr> <tr valign="top"><td><code>id</code></td> <td> <p>A unique identifier for the notification. </p> <p><code>id</code> is optional for <code>showNotification()</code>: Shiny will automatically create one if needed. If you do supply it, Shiny will update an existing notification if it exists, otherwise it will create a new one. </p> <p><code>id</code> is required for <code>removeNotification()</code>.</p> </td></tr> <tr valign="top"><td><code>type</code></td> <td> <p>A string which controls the color of the notification. One of "default" (gray), "message" (blue), "warning" (yellow), or "error" (red).</p> </td></tr> <tr valign="top"><td><code>session</code></td> <td> <p>Session object to send notification to.</p> </td></tr> </table> <h3>Value</h3> <p>An ID for the notification. </p> <h3>Examples</h3> <pre> ## Only run examples in interactive R sessions if (interactive()) { # Show a message when button is clicked shinyApp( ui = fluidPage( actionButton("show", "Show") ), server = function(input, output) { observeEvent(input$show, { showNotification("Message text", action = a(href = "javascript:location.reload();", "Reload page") ) }) } ) # App with show and remove buttons shinyApp( ui = fluidPage( actionButton("show", "Show"), actionButton("remove", "Remove") ), server = function(input, output) { # A queue of notification IDs ids <- character(0) # A counter n <- 0 observeEvent(input$show, { # Save the ID for removal later id <- showNotification(paste("Message", n), duration = NULL) ids <<- c(ids, id) n <<- n + 1 }) observeEvent(input$remove, { if (length(ids) > 0) removeNotification(ids[1]) ids <<- ids[-1] }) } ) } </pre> <hr /><div style="text-align: center;">[Package <em>shiny</em> version 1.5.0 <a href="00Index.html">Index</a>]</div> </body></html>