Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/MangoTheCat/shinytoastr
Notifications in Shiny apps
https://github.com/MangoTheCat/shinytoastr
Last synced: about 2 months ago
JSON representation
Notifications in Shiny apps
- Host: GitHub
- URL: https://github.com/MangoTheCat/shinytoastr
- Owner: MangoTheCat
- License: other
- Created: 2016-06-05T21:22:54.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-08-29T19:53:03.000Z (over 8 years ago)
- Last Synced: 2024-08-03T03:02:33.430Z (5 months ago)
- Language: R
- Size: 68.4 KB
- Stars: 92
- Watchers: 10
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-shiny-extensions - shinytoastr - Notifications for Shiny apps, via toastr. (UI Components / Feedback / Alert / Notification)
- jimsghstars - MangoTheCat/shinytoastr - Notifications in Shiny apps (R)
README
# shinytoastr
> Notifications in Shiny, via [toastr](https://github.com/CodeSeven/toastr)
[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)
[![Linux Build Status](https://travis-ci.org/MangoTheCat/shinytoastr.svg?branch=master)](https://travis-ci.org/MangoTheCat/shinytoastr)
[![Windows Build status](https://ci.appveyor.com/api/projects/status/github/MangoTheCat/shinytoastr?svg=true)](https://ci.appveyor.com/project/gaborcsardi/shinytoastr)
[![](http://www.r-pkg.org/badges/version/shinytoastr)](http://www.r-pkg.org/pkg/shinytoastr)
[![CRAN RStudio mirror downloads](http://cranlogs.r-pkg.org/badges/shinytoastr)](http://www.r-pkg.org/pkg/shinytoastr)
## Installation
```r
source("https://install-github.me/mangothecat/shinytoastr")
```## Usage
Call `useToastr()` at the beginning of `ui` definition, and then
in the `server` definition use one of the notification functions,
`toastr_success()`, `toastr_info()`, `toastr_warning()` or
`toastr_error()` to create notifications:```r
library(shinytoastr)ui <- shinyUI(fluidPage(
useToastr(),
pageWithSidebar(
headerPanel("Header"),
sidebarPanel(
...
actionButton(inputId = "save_button", label = "Save",
class = "btn-primary")
...
),
mainPanel(
...
)
)
))
``````r
server <- function(input, output, session) {
...
observeEvent(
input$save_button,
{
tryCatch(
{
writeToDB(data)
toastr_success("Saved to database")
},
error = function(e) {
toastr_error(title = "Database error", conditionMessage(e))
}
)
}
)
}
```## License
MIT © John Papa, Tim Ferrell, Hans Fjällemark,
[Mango Solutions](https://github.com/mangothecat).