notiflix-report: Report with notiflix.js

Description Usage Arguments Note Examples

Description

Initialize with use_notiflix_report in UI before using nx_report_* server-side.

Usage

 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
nx_report_success(
  title,
  message,
  button = "Ok",
  session = shiny::getDefaultReactiveDomain()
)

nx_report_error(
  title,
  message,
  button = "Ok",
  session = shiny::getDefaultReactiveDomain()
)

nx_report_info(
  title,
  message,
  button = "Ok",
  session = shiny::getDefaultReactiveDomain()
)

nx_report_warning(
  title,
  message,
  button = "Ok",
  session = shiny::getDefaultReactiveDomain()
)

use_notiflix_report(
  backgroundColor = "#f8f8f8",
  borderRadius = "25px",
  backOverlay = TRUE,
  backOverlayColor = "rgba(0,0,0,0.5)",
  titleFontSize = "16px",
  titleMaxLength = 34,
  messageFontSize = "13px",
  messageMaxLength = 400,
  buttonFontSize = "14px",
  buttonMaxLength = 34,
  cssAnimation = TRUE,
  cssAnimationDuration = 360,
  cssAnimationStyle = c("fade", "zoom"),
  plainText = FALSE,
  width = "280px"
)

Arguments

title

Title of the report.

message

Message of the report.

button

Label of the button.

session

Shiny session.

backgroundColor

Changes the background color.

borderRadius

Changes the radius of the corners.

backOverlay

If you don't want to use a colored overlay you can change this option to FALSE.

backOverlayColor

Changes the color of the overlay. You can use HEX, RGB or RGBA.

titleFontSize

Changes the font-size of the title text.

titleMaxLength

Ignores characters of title text after the specified number.

messageFontSize

Changes the font-size of the message text.

messageMaxLength

Ignores characters of message text after the specified number.

buttonFontSize

Changes the font-size of the button text.

buttonMaxLength

Ignores characters of button text after the specified number.

cssAnimation

Notiflix uses CSS animations to show/hide the Reports. If you don't want to use CSS animations you can set this option to FALSE.

cssAnimationDuration

Changes the CSS animations duration as milliseconds. Tip: 360 ms = 0.36 second.

cssAnimationStyle

2 types of styles you can use: "fade" and "zoom".

plainText

Use only plain text (no HTML tags). Default to FALSE.

width

Changes the width. You can use "px" or "%". Default to "280px".

Note

Configuration of report is done with use_notiflix_report in UI per application.

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
if (interactive()) {

  library(shiny)

  ui <- fluidPage(
    tags$h2("Reports with notiflix.js"),
    use_notiflix_report(),
    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_report_success("Bravo!", "Everything worked as expected")
    })

    observeEvent(input$error, {
      nx_report_error("Oups...", "Something went wrong")
    })

    observeEvent(input$info, {
      nx_report_info(
        "Notice",
        tags$p(
          style = "text-align: center;",
          "Current version of this package : ",
          tags$b(as.character(packageVersion("shinypop")))
        )
      )
    })

    observeEvent(input$warning, {
      nx_report_warning("Attention !!!", "There's some warnings")
    })

  }

  shinyApp(ui, server)

}

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