error_box: error_box

Description Usage Arguments References Examples

View source: R/error_box.R

Description

Create an error message box to inform users when an error has occured. This element is designed to render without an message. Use the server-side function show_error_box to render an message into the error box, and then the hide_error_box to reset the error. You can further customize the error box to fit the error by choosing an icon made available by the rheroicons package.

Usage

1
2
3
4
5
6
error_box(
  inputId,
  class = NULL,
  icon_name = "exclamation",
  icon_type = "outline"
)

Arguments

inputId

a unique id for the error box

class

pass css class names

icon_name

an rheroicons icon name

icon_type

an rheroicons icon type ("output" or "solid")

References

https://github.com/davidruvolo51/rheroicons

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

  ui <- tagList(
    iceComponents::use_iceComponents(),
    iceComponents::container(
      iceComponents::page(
        tags$h2("My App"),
        tags$p("Please wait while the app loads..."),
        iceComponents::error_box(
          inputId = "shiny-server-error"
        )
      )
    )
  )

  server <- function() {
    err <- function() {
       Sys.sleep(2)
       iceComponents::show_error_box(
         inputId = "shiny-server-error",
         error = "Internal Server Error (500)"
       )
    }

    err()

  }

  shinyApp(ui, server)

}

InControlofEffects/iceComponents documentation built on April 1, 2021, 5:51 a.m.