Lightweight toast notifications
useToast()toast(
title = "Hey",
message = NULL,
type = NULL,
theme = NULL,
position = "center",
duration = 5000,
progress_bar_color = NULL,
background_color = NULL,
max_width = NULL,
title_color = NULL,
title_size = NULL,
title_line_height = NULL,
message_color = NULL,
message_size = NULL,
message_line_height = NULL,
image = NULL,
image_width = NULL,
zindex = 99999,
layout = 1,
balloon = FALSE,
close = TRUE,
close_on_escape = FALSE,
close_on_click = FALSE,
rtl = FALSE,
display_mode = 0,
drag_to_close = TRUE,
pause_on_hover = TRUE,
reset_on_hover = FALSE,
progress_bar_easing = "linear",
overlay = FALSE,
overlay_close = FALSE,
overlay_color = "rgba(0, 0, 0, 0.6)",
animate_inside = TRUE,
transition_in = "fadeInUp",
transition_out = "fadeOut",
session = getDefaultReactiveDomain()
)
None
Title of the toast.
Message of toast.
Type of notification. Defaults to NULL
. Valid values are:
"info"
"success"
"warning"
"error"
Theme of toast. Choose between "light"
or "dark"
.
Where toast will be shown. Defaults to "bottomRight"
. Valid values are:
"bottomRight"
"bottomLeft"
"topRight"
"topLeft"
"topCenter"
"bottomCenter"
"center"
Time in milliseconds to close the toast. Defaults to 5000
. Use FALSE
to disable.
Progress bar color. Choose between hexadecimal, RGB or keyword values.
Background color of the toast. Choose between hexadecimal, RGB or keyword values.
Maximum width of the toast.
Title color. Choose between hexadecimal, RGB or keyword values.
Title font size.
Title line height.
Message color. Choose between hexadecimal, RGB or keyword values.
Message font size.
Message line height.
Cover image.
Width of cover image. Defaults to "50px"
.
The z-index CSS attribute of the toast. Defaults to 99999
.
Size of the toast. Choose between 1
or 2
.
Logical; if TRUE
, applies a balloon like toast. Defaults to FALSE
.
Logical; if TRUE
(the default), shows a x
close button.
Logical; if TRUE
, allows to close toast using ESC key. Defaults to FALSE
.
Logical; if TRUE
, allows to close toast by clicking on it. Defaults to FALSE
.
Logical; if TRUE
, applies Right to Left style. Defaults to FALSE
.
Rules to show multiple toasts. Default is 0
. Valid values are:
0
: Waits until the current toast is closed before displaying a new one.
1
: Replaces the current toast with the new toast toast.
Logical; if TRUE
(the default), toast can be closed by dragging it.
Logical; if TRUE
(the default), pauses the toast timeout while the cursor is on it.
Logical; if TRUE
, resets the toast timeout while the cursor is on it. Defaults to FALSE
.
Animation easing of progress bar. Defaults to "linear"
.
Logical; if TRUE
, displays the overlay layer on the page. Defaults to FALSE
.
Logical; if TRUE
, allows to close the toast by clicking on the overlay. Defaults to FALSE
.
Overlay background color. Defaults to "rgba(0, 0, 0, 0.6)"
. Choose between hexadecimal, RGB or keyword values.
Logical; if TRUE
(the default), enables animation of elements in the toast.
Toast open animation. Defaults to "fadeInUp"
. Valid values are:
"bounceInLeft"
"bounceInRight"
"bounceInUp"
"bounceInDown"
"fadeIn"
"fadeInDown"
"fadeInUp"
"fadeInLeft"
"fadeInRight"
"flipInX"
Toast close animation. Defaults to "fadeOut"
. Valid values are:
"fadeOut"
"fadeOutDown"
"fadeOutUp"
"fadeOutLeft"
"fadeOutRight"
"flipOutX"
Shiny session object.
useToast
: Dependencies to include in your UI.
toast
: Display toast notifications.
if (interactive()) {
library(shiny)
library(standby)
ui <- fluidPage(
useToast(), # include dependencies
actionButton(inputId = "btn",
label = "iziToast Demo")
)
server <- function(input, output, session) {
observeEvent(input$btn, {
# display toast notification
toast("Hey there!", "Thank you for exploring standby!")
})
}
shinyApp(ui, server)
}
Run the code above in your browser using DataLab