Git Product home page Git Product logo

shinypop's Introduction

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. R build status

Installation

You can install dev version from GitHub:

remotes::install_github("dreamRs/shinypop")

Notifications

Notifications libraries included :

noty

Notifications with various themes and options to configure :

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)

notie

Top or bottom full width notifications :

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)

push

push.js allow to create desktop notification (outside the browser), user must allow this type of notification.

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)

notiflix

Fully configurable notifications :

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)

Confirmation dialogs

Confirmation dialogs can be done with :

notie

Ask user confirmation :

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)

notiflix

Ask user confirmation :

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)

Alerts

For alerts you can use :

notiflix

Show an alert :

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)

Related packages

Those packages include similar functionnalities :

shinypop's People

Contributors

pvictor avatar tomicapretto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

shinypop's Issues

Add `titleColor` option to notiflix confirm

Hi! Thank you for this great package, my apps now look much better!

I would like to know if it is possible to add the titleColor argument to shinypop::use_notiflix_confirm() so one can use the
same color for the title and the confirm button background, for example.

If you want, I can try to incorporate this and then make a PR to incorporate the changes.

Thank you!

Vex alert remove close button

Hi, very cool package.

I was expecting this example to not show a button (similar to easyClose = FALSE for a shiny::modalDialog).
Please advise how I can remove the button.

Thank you

ui <- fluidPage(
  tags$h2("Alert with vex example"),
  use_vex(),
  actionButton("launch", "Launch an alert")
)

server <- function(input, output, session) {
  
  observeEvent(input$launch, {
    vex(
      showCloseButton = FALSE,
      escapeButtonCloses = FALSE,
      overlayClosesOnClick = FALSE,
      session = session,
      tags$div(
      style = "text-align: center;",
      tags$h3("Attention"),
      tags$br(),
      tags$p("This alert was sent from the server")
    ))
  })
  
}

shinyApp(ui, server)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.