-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
144 lines (107 loc) · 5.7 KB
/
README.Rmd
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# standby
<!-- badges: start -->
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/standby)](https://cran.r-project.org/package=standby)
[![cran checks](https://badges.cranchecks.info/summary/standby.svg)](https://cran.r-project.org/web/checks/check_results_standby.html)
[![R-CMD-check](https://github.com/rsquaredacademy/standby/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/rsquaredacademy/standby/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/rsquaredacademy/standby/branch/master/graph/badge.svg)](https://app.codecov.io/gh/rsquaredacademy/standby?branch=master)
[![status](https://tinyverse.netlify.com/badge/standby)](https://CRAN.R-project.org/package=standby)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html)
<!-- badges: end -->
Easily create alerts, notifications, tooltips and loading screens in Shiny
## Installation
```{r cran-installation, eval = FALSE}
# Install release version from CRAN
install.packages("standby")
# Install development version from GitHub
# install.packages("devtools")
devtools::install_github("rsquaredacademy/standby")
```
## Usage
### Loading Screens
To use spinners/loaders from **standby** in your Shiny application, include the
following in the **UI** part of the app:
- Include the dependencies using the appropriate `use*` functions
(`useSpinkit()` in the below example).
- Wrap the target output using corresponding rendering function
(`spinkit()` in the below example).
##### Example
```{r standby, eval=FALSE}
library(shiny)
library(standby)
ui <- fluidPage(
standby::useSpinkit(), # include dependencies
fluidRow(
standby::spinkit(plotOutput("plot1")), # wrap output inside loader
actionButton("render", "Render")
)
)
server <- function(input, output, session) {
output$plot1 <- renderPlot({
input$render
Sys.sleep(3)
hist(mtcars$mpg)
})
}
shinyApp(ui, server)
```
#### Details
The below table displays the dependency and rendering functions along with references:
| Index | Dependency | Render | Reference |
| ------| ------------- | ------------- | ------------- |
| 1 | `useThreeDots()` | `threeDots()` | [Three Dots](https://github.com/nzbin/three-dots) |
| 2 | `useSpinkit()` | `spinkit()` | [SpinKit](https://github.com/tobiasahlin/SpinKit) |
| 3 | `useVizLoad()` | `vizLoad()` | [Loading Visualization](https://github.com/RIDICS/Loading-Visualization) |
| 4 | `useSpinners()` | `spinners()` | [Spinners](https://github.com/lukehaas/css-loaders) |
| 5 | `useLoaders()` | `loaders()` | [Loaders](https://github.com/raphaelfabeni/css-loader) |
### Alerts and Notifications
To use alerts or notifications from **buzz** in your Shiny application, follow the below steps:
- Include the dependencies in the **UI** part of the app using the appropriate
`use*` functions (`useToast()` in the below example).
- Include the corresponding rendering function in the **Server** part of the
app (`toast()` in the below example).
##### Example
```{r buzz, eval=FALSE}
library(shiny)
library(standby)
ui <- fluidPage(
useBootBox(), # include dependencies
actionButton(inputId = "notify",
label = "Show Notification")
)
server <- function(input, output, session) {
observeEvent(input$pnotify, {
bootBox(class = "rubberBand") # display the alert
})
}
shinyApp(ui, server)
```
#### Details
The below table displays the dependency and rendering functions along with references:
| Index | Dependency | Render | Reference |
| ------| ------------- | ------------- | ------------- |
| 1 | `useAlertify()` | `alertify_alert()` | [Alertify](https://github.com/MohammadYounes/AlertifyJS) |
| 2 | `useAlertify()` | `alertify_notify()` | [Alertify](https://github.com/MohammadYounes/AlertifyJS) |
| 3 | `useBootBox()` | `bootBox()` | [BootBox](https://github.com/bootboxjs/bootbox) |
| 4 | `useMicroTip()` | `microTip()` | [MicroTip](https://github.com/ghosh/microtip) |
| 5 | `useNS()` | `notice()` | [Notification Styles](https://tympanus.net/Development/NotificationStyles/) |
| 6 | `useNotify()` | `notify()` | [PNotify](https://github.com/sciactive/pnotify) |
| 7 | `useTingle()` | `tingle()` | [Tingle](https://github.com/robinparisi/tingle) |
| 8 | `useToast()` | `toast()` | [iziToast](https://github.com/marcelodolza/iziToast) |
## Getting Help
If you encounter a bug, please file a minimal reproducible example using
[reprex](https://reprex.tidyverse.org/index.html) on github. For questions and clarifications,
use [StackOverflow](https://stackoverflow.com/).
## Code of Conduct
Please note that the standby project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.