This example demonstrates creating a Shiny input wrapper around the react-color library.
Because this package includes JavaScript source code that requires a compilation step, package installation is in two phases: JavaScript tools build the JavaScript, and R tools build and install the package. The R package includes the built JavaScript files in the inst/ directory.
Building JavaScript should work on macOS, Linux, and Windows. The following tools are necessary regardless of your platform:
You should install the reactR package if you haven't, as this input depends on it.
After you've installed Node.js and Yarn, run the following command to resolve and download dependencies:
yarn install Now, run yarn to build www/colorpicker/colorpicker/colorpicker.js:
yarn run webpack To run
yarn webpackautomatically whenever sources change, use the commandyarn run webpack --watch
Now that the JavaScript is built, you can install the R package:
devtools::document() devtools::install() Finally you can try the example app by running app.R.