|
- ---
- output: github_document
- ---
-
- ```{r setup, include=FALSE}
- knitr::opts_chunk$set(eval = FALSE)
-
- github_sha_link <- function(sha) {
- glue::glue("[{sha}](https://github.com/gadenbuie/js4shiny-frappeCharts/commit/{sha})")
- }
- ```
-
-
- # Building a Shiny Input
-
- In this project,
- we're going to create a typing speed app
- using a custom Shiny input.
- The app will give users typing prompts,
- monitor their typing speed,
- and use a Frappe Chart line chart
- to show their speed over time as they type.
-
- ## Setup a folder for our app inside the frappeCharts package
-
- `r github_sha_link("2188781657884a743c2c4f94dc1fa7755a7de261")`
-
- Create the directory `inst/shiny-input-app` and add `app.R` and `typing.js`.
-
- ```{r}
- usethis::use_directory("inst/shiny-input-app")
- file.create("inst/shiny-input-app/app.R")
- file.create("inst/shiny-input-app/typing.js")
- ```
-
- ## Create a basic Shiny app with a typing area
-
- We'll start with typical Shiny inputs.
-
- ```r
- library(shiny)
-
- ui <- fluidPage(
- textAreaInput("typing", "Type here..."),
- verbatimTextOutput("debug")
- )
-
- server <- function(input, output, session) {
- output$debug <- renderPrint(input$typing)
- }
-
- shinyApp(ui, server)
- ```
-
- Run this app and type in the box.
|