knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "inst/images/README-",
  out.width = "100%"
)

shinykeyboard

{shinykeyboard} is an R package to create an on-screen keyboard input widget in R Shiny. The package converts beautiful keyboards from Sharla Gelfand's {ggkeyboard} package and turns them into real, clickable on-screen keyboards that return a value of the keystroke.

Installation

You can install the released version of {shinykeyboard} from GitHub with:

remotes::install_github("willdebras/shinykeyboard")

Usage

The package contains a single UI input function keyboardInput() that takes two parameters:

 keyboardInput(inputId = "keebs", color_palette = "sharla3")

An on-screen keyboard will appear in your shiny app.

example on screen keyboard

To return the value for a single key, simply click the key or input the keystroke on your computer keyboard.

example of a keystroke

To return multiple keystrokes together, either input keystrokes on a keyboard at the same time or toggle the multi-stroke switch at the top of the keyboard.

example of a keystroke

Customization

The package contains three palettes to use by passing to the color_palette parameter.

keyboardInput(inputId = "keebs", color_palette = "sharla1")

```r knitr::include_graphics("inst/images/sharla1.png")

```

keyboardInput(inputId = "keebs", color_palette = "sharla2")

```r knitr::include_graphics("inst/images/sharla2.png")

```

keyboardInput(inputId = "keebs", color_palette = "sharla3")

```r knitr::include_graphics("inst/images/sharla3.png")

```

Example

An example application using the shinykeyboard input:

library(shiny)
library(shinykeyboard)

ui <- function() {

    fluidPage(
            keyboardInput("keebs", color_palette = "sharla1"),
            verbatimTextOutput("debug")
    )
}

server <- function(input, output) {
    output$debug <- renderPrint(input$keebs)
}

shinyApp(ui = ui, server = server)


willdebras/shinykeyboard documentation built on Aug. 6, 2020, 8:13 p.m.