createReactShinyInput: Create a React-based input

Description Usage Arguments Value Examples

View source: R/reacttools.R

Description

Create a React-based input

Usage

1
2
3
4
5
6
7
8
createReactShinyInput(
  inputId,
  class,
  dependencies,
  default = NULL,
  configuration = list(),
  container = htmltools::tags$div
)

Arguments

inputId

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

class

Space-delimited list of CSS class names that should identify this input type in the browser.

dependencies

HTML dependencies to include in addition to those supporting React. Must contain at least one dependency, that of the input's implementation.

default

Initial value.

configuration

Static configuration data.

container

Function to generate an HTML element to contain the input.

Value

Shiny input suitable for inclusion in a UI.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
myInput <- function(inputId, default = "") {
  # The value of createReactShinyInput should be returned from input constructor functions.
  createReactShinyInput(
    inputId,
    "myinput",
    # At least one htmlDependency must be provided -- the JavaScript implementation of the input.
    htmlDependency(
      name = "my-input",
      version = "1.0.0",
      src = "www/mypackage/myinput",
      package = "mypackage",
      script = "myinput.js"
    ),
    default
  )
}

react-R/reactR documentation built on Feb. 26, 2021, 5:50 a.m.