notie: Notification with notie.js

Description Usage Arguments Examples

View source: R/notie.R

Description

Initialize with use_notie in UI before using notie server-side. Close all notifications with notie_close.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
notie(
  text,
  time = getOption("notie.time", default = 3),
  type = c("info", "neutral", "success", "error", "warning"),
  position = c("bottom", "top"),
  session = shiny::getDefaultReactiveDomain()
)

notie_close(session = shiny::getDefaultReactiveDomain())

use_notie()

use_push()

Arguments

text

Text to display.

time

Delay for closing notification in seconds (s).

type

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

position

Where to display notification: "bottom" or "top".

session

Shiny session.

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
library(shiny)
library(shinypop)

ui <- fluidPage(
  tags$h2("notie example"),
  use_notie(),
  radioButtons(
    inputId = "type",
    label = "Type:",
    choices = c("info", "neutral",
                "success", "error",
                "warning"),
    inline = TRUE
  ),
  radioButtons(
    inputId = "position",
    label = "Position:",
    choices = c("bottom", "top"),
    inline = TRUE
  ),
  actionButton(
    inputId = "show",
    label = "Show notification",
    width = "100%"
  )
)

server <- function(input, output, session) {
  
  observeEvent(input$show, {
    notie(
      text = "Hello world!",
      type = input$type,
      position = input$position
    )
  })
  
}

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

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