Learn how to add custom js functions for more interactivity in shiny apps. In this example, we will create a dark and light theme toggle and learn how to save the user preferences for later use. For more information, checkout the blog post Getting started with javascript handlers: Linking R and Javascript.
You can run this app locally using the following methods: running within your R environment or cloning this subdirectory.
You can run this app within your R environment using the runGithub
function. Enter the following command in the console.
shiny::runGitHub(username = "davidruvolo51", repo = "shinyAppTutorials", subdir = "js-handlers")
You can clone the data editor subdirectory using git sparse-checkout
.
git clone --filter=blob:none --sparse https://github.com/davidruvolo51/shinyAppTutorials
cd shinyAppTutorials
git sparse-checkout init --cone
git sparse-checkout set js-handlers
Then you can run the shiny app in your preferred R environment.