Skip to content

Keybinding functionality for Shiny Apps

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

OekoFor/shinykeybindings

Repository files navigation

shinykeybindings

Lifecycle: experimental

Set keybindings that allow you to navigate your Shiny App using keyboard shortcuts.
This package lets you
👈 perform clicking actions
👓 focus widgets
🕜 trigger reactivity
✔️ set values of radio buttons

Installation

You can install the latest released version of shinykeybindings from GitHub with:

# install.packages("devtools")
devtools::install_github("OekoFor/shinykeybindings@*release")

Example

This minimal example adds the keyboard shortcut ctrl + Enter to the example app of shiny::actionButton()

library(shinykeybindings)
## Only run examples in interactive R sessions
if (interactive()) {
  ui <- fluidPage(
    sliderInput("obs", "Number of observations", 0, 1000, 500),
    actionButton("goButton", "Go!", class = "btn-success"),
    plotOutput("distPlot"),

    # keybinding
    kb_click("goButton", key = "Enter", modifier = "ctrl")
  )

  server <- function(input, output) {
    output$distPlot <- renderPlot({
      # Take a dependency on input$goButton. This will run once initially,
      # because the value changes from NULL to 0.
      input$goButton

      # Use isolate() to avoid dependency on input$obs
      dist <- isolate(rnorm(input$obs))
      hist(dist)
    })
  }

  shinyApp(ui, server)
}

For a complete example Shiny App run kb_examples()

About

Keybinding functionality for Shiny Apps

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published

Languages