createReactShinyInput: Create a React-based input

View source: R/reacttools.R

createReactShinyInputR Documentation

Create a React-based input

Description

Create a React-based input

Usage

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

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 Sept. 15, 2024, 8:34 p.m.