Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dreamRs/shinypop
Collection of notifications, confirm dialogs and alerts for 'Shiny' applications
https://github.com/dreamRs/shinypop
r shiny shinyapps
Last synced: 3 months ago
JSON representation
Collection of notifications, confirm dialogs and alerts for 'Shiny' applications
- Host: GitHub
- URL: https://github.com/dreamRs/shinypop
- Owner: dreamRs
- License: gpl-3.0
- Created: 2019-06-24T07:36:35.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-10-14T14:33:14.000Z (about 3 years ago)
- Last Synced: 2024-06-11T19:34:57.092Z (5 months ago)
- Topics: r, shiny, shinyapps
- Language: JavaScript
- Size: 402 KB
- Stars: 51
- Watchers: 3
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-shiny-extensions - shinypop - Collection of notifications, confirm dialogs, and alerts for Shiny apps based on noty, notie, push.js, and notiflix. (UI Components / Feedback / Alert / Notification)
- jimsghstars - dreamRs/shinypop - Collection of notifications, confirm dialogs and alerts for 'Shiny' applications (JavaScript)
README
# shinypop
> Collection of notifications and dialogs for Shiny applications
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![R build status](https://github.com/dreamRs/shinypop/workflows/R-CMD-check/badge.svg)](https://github.com/dreamRs/shinypop/actions)## Installation
You can install dev version from GitHub:
``` r
remotes::install_github("dreamRs/shinypop")
```## Notifications
Notifications libraries included :
* noty : https://github.com/needim/noty
* notie : https://github.com/jaredreich/notie
* push : https://github.com/Nickersoft/push.js
* notiflix : https://github.com/notiflix/Notiflix
* vex : https://github.hubspot.com/vex/docs/welcome/### noty
Notifications with various themes and options to configure :
```r
ui <- fluidPage(
tags$h2("noty example"),
use_noty(),
actionButton(
inputId = "show",
label = "Show notification"
)
)server <- function(input, output, session) {
observeEvent(input$show, {
noty(text = "Hello world!", type = "info")
})
}shinyApp(ui, server)
```![](man/figures/noty-sunset.png)
![](man/figures/noty-relax.png)### notie
Top or bottom full width notifications :
```r
ui <- fluidPage(
tags$h2("notie example"),
use_notie(),
actionButton(
inputId = "show",
label = "Show notification",
width = "100%"
)
)server <- function(input, output, session) {
observeEvent(input$show, {
notie(
text = "Hello world!",
type = "info",
position = "bottom"
)
})}
shinyApp(ui, server)
```![](man/figures/notie-notification.png)
### push
push.js allow to create desktop notification (outside the browser), user must allow this type of notification.
```r
ui <- fluidPage(
tags$h2("Push notification"),
use_push(),
actionButton("show", "Show notification"),
textInput("title", "Text to display", "Hello world :)")
)server <- function(input, output, session) {
observeEvent(input$show, {
push(title = input$title)
})
}shinyApp(ui, server)
```![](man/figures/push.png)
### notiflix
Fully configurable notifications :
```r
ui <- fluidPage(
tags$h2("Notification with notiflix.jx"),
use_notiflix_notify(position = "right-bottom"),
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_notify_success("Yes :)")
})observeEvent(input$error, {
nx_notify_error("Oups...")
})observeEvent(input$info, {
nx_notify_info("For information")
})observeEvent(input$warning, {
nx_notify_warning("Careful !!!")
})}
shinyApp(ui, server)
```![](man/figures/notiflix-notify.png)
## Confirmation dialogs
Confirmation dialogs can be done with :
* notie : https://github.com/jaredreich/notie
* notiflix : https://github.com/notiflix/Notiflix### notie
Ask user confirmation :
```r
ui <- fluidPage(
use_notie(),
tags$h2("notie.js confirmation pop-up"),
actionButton("show", "Ask for confirmation"),
verbatimTextOutput("result")
)server <- function(input, output, session) {
observeEvent(input$show, {
notie_confirm(
inputId = "confirm",
text = "Do you want to confirm?",
label_submit = "Sure!",
label_cancel = "Nope!"
)
})output$result <- renderPrint({
input$confirm
})
}shinyApp(ui, server)
```![](man/figures/notie-confirm.png)
### notiflix
Ask user confirmation :
```r
ui <- fluidPage(
use_notiflix_confirm(),
tags$h2("notiflix confirmation pop-up"),
actionButton("show", "Ask for confirmation"),
verbatimTextOutput("result")
)server <- function(input, output, session) {
observeEvent(input$show, {
nx_confirm(
inputId = "confirm",
title = "Do you want to confirm?",
button_ok = "Sure!",
button_cancel = "Nope!"
)
})
output$result <- renderPrint({
input$confirm
})
}shinyApp(ui, server)
```![](man/figures/notiflix-confirm.png)
## Alerts
For alerts you can use :
* notiflix : https://github.com/notiflix/Notiflix
* vex: https://github.com/hubspot/vex### notiflix
Show an alert :
```r
ui <- fluidPage(
tags$h2("Reports with notiflix.jx"),
use_notiflix_report(),
actionButton("success", "Show success", class = "btn-success")
)server <- function(input, output, session) {
observeEvent(input$success, {
nx_report_success("Bravo!", "Everything worked as expected")
})}
shinyApp(ui, server)
```![](man/figures/notiflix-report.png)
## Related packages
Those packages include similar functionnalities :
* [`shinyalert`](https://github.com/daattali/shinyalert) allow to use [sweetalert](https://github.com/t4t5/sweetalert)
* [`shinyWidgets`](https://github.com/dreamRs/shinyWidgets) allow to use [sweetalert2](https://github.com/sweetalert2/sweetalert2)
* [`shinytoastr`](https://github.com/MangoTheCat/shinytoastr) allow to use [toastr](https://github.com/CodeSeven/toastr)