Description Usage Arguments Note Examples
Initialize with use_notiflix_notify
in UI before using nx_notify_*
server-side.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | nx_notify_success(text, session = shiny::getDefaultReactiveDomain())
nx_notify_error(text, session = shiny::getDefaultReactiveDomain())
nx_notify_info(text, session = shiny::getDefaultReactiveDomain())
nx_notify_warning(text, session = shiny::getDefaultReactiveDomain())
use_notiflix_notify(
position = c("right-top", "right-bottom", "left-top", "left-bottom"),
timeout = 3000,
closeButton = FALSE,
messageMaxLength = 110,
width = "280px"
)
|
text |
Text to display. |
session |
Shiny session. |
position |
Position of notification : |
timeout |
Milliseconds to hide the Notifications. Tip: 3000 ms = 3 seconds. |
closeButton |
If you want to add a close button to notifications
you can set this option to |
messageMaxLength |
Ignores characters of the message text after the specified number. |
width |
Changes the width. You can use "px" or "%". Default to |
Configuration of notification is done with use_notiflix_notify
in UI per application.
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 | library(shiny)
library(shinypop)
ui <- fluidPage(
tags$h2("Notification with notiflix.js"),
use_notiflix_notify(position = "right-bottom"),
actionButton("success", "Show success", class = "btn-success"),
actionButton("error", "Show error", class = "btn-danger"),
actionButton("info", "Show info", class = "btn-info"),
actionButton("warning", "Show warning", class = "btn-warning")
)
server <- function(input, output, session) {
observeEvent(input$success, {
nx_notify_success("Yes :)")
})
observeEvent(input$error, {
nx_notify_error("Oups...")
})
observeEvent(input$info, {
nx_notify_info("For information")
})
observeEvent(input$warning, {
nx_notify_warning("Careful !!!")
})
}
if (interactive())
shinyApp(ui, server)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.