keysInput {keys}R Documentation

Create a keys input control

Description

Create a key input that can be used to observe keys pressed by the user.

Usage

keysInput(inputId, keys, global = FALSE)

Arguments

inputId

The input slot that will be used to access the value.

keys

A character vector of keys to bind. Examples include, command, command+shift+a, ⁠up down left right⁠, and more.

global

Should keys work anywhere? If TRUE, keys are triggered when inside a textInput.

Examples

## Not run: 
ui <- fluidPage(
  keysInput("keys", c(
    "1",
    "2",
    "3",
    "command+shift+k",
    "up up down down left right left right b a enter"
  )),
)

server <- function(input, output, session) {
  observeEvent(input$keys, {
    print(input$keys)
  })
}

shinyApp(ui, server)

## End(Not run)


[Package keys version 0.1.1 Index]