noty: Notification with noty.js

Description Usage Arguments Examples

View source: R/noty.R

Description

Initialize with use_noty in UI before using noty server-side. Close all notifications with noty_close.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
noty(
  text,
  timeout = getOption("noty.timeout", default = 2000),
  type = c("info", "alert", "success", "error", "warning"),
  layout = c("topRight", "top", "topLeft", "topCenter", "center", "centerLeft",
    "centerRight", "bottom", "bottomLeft", "bottomCenter", "bottomRight"),
  theme = getOption("noty.theme", default = "sunset"),
  modal = FALSE,
  killer = FALSE,
  animation_open = NULL,
  animation_close = NULL,
  session = shiny::getDefaultReactiveDomain()
)

noty_close(session = shiny::getDefaultReactiveDomain())

use_noty(maxVisible = 5)

Arguments

text

Text to display.

timeout

Delay for closing notification in milliseconds (ms). Set FALSE for sticky notifications.

type

Type of notification: "alert", "success", "error", "warning", "info".

layout

Position among : "top", "topLeft", "topCenter", "topRight", "center", "centerLeft", "centerRight", "bottom", "bottomLeft", "bottomCenter", ""bottomRight".

theme

Theme to use between : "mint", "sunset", "relax", "nest", "metroui", "semanticui", "light", "bootstrap-v3", "bootstrap-v4".

modal

Add an overlay to the page to emphasis notification.

killer

Close all others notification before opening.

animation_open, animation_close

Animation effect, use animations.

session

Shiny session.

maxVisible

Maximum number of notifications that can appear at a time.

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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
library(shiny)
library(shinypop)

ui <- fluidPage(
  tags$h2("noty example"),
  use_noty(),
  radioButtons(
    inputId = "type",
    label = "Type:",
    choices = c("info", "alert",
                "success", "error",
                "warning"),
    inline = TRUE
  ),
  radioButtons(
    inputId = "layout",
    label = "Layout:",
    choices = c("topRight", "top",
                "topLeft", "topCenter",
                "center", "centerLeft",
                "centerRight", "bottom",
                "bottomLeft", "bottomCenter",
                "bottomRight"),
    inline = TRUE
  ),
  radioButtons(
    inputId = "theme",
    label = "Theme:",
    choices = c("mint", "sunset",
                "relax", "nest",
                "metroui", "semanticui",
                "light", "bootstrap-v3",
                "bootstrap-v4"),
    inline = TRUE
  ),
  checkboxInput(
    inputId = "killer",
    label = "Killer",
    value = FALSE
  ),
  checkboxInput(
    inputId = "modal",
    label = "Modal",
    value = FALSE
  ),
  actionButton(
    inputId = "show",
    label = "Show notification",
    width = "100%"
  )
)

server <- function(input, output, session) {
  
  observeEvent(input$show, {
    noty(
      text = "Hello world!",
      type = input$type,
      layout = input$layout,
      theme = input$theme,
      modal = input$modal,
      killer = input$killer
    )
  })
  
}

if (interactive()) 
  shinyApp(ui, server)

dreamRs/shinypop documentation built on Oct. 18, 2021, 8:28 p.m.