
Either use this input value as part of your reactive expressions, output renderers, and observers or use observeEvent(input$foo, shinyApp ( ui, server ) While this is normally done using an input binding, you can skip all the ceremony and directly send a reactive input value to R with this JavaScript function:įor example, tInputValue("foo", "bar") will cause the server’s input$foo to be set to "bar". From JavaScript to RĬommunication from JavaScript to R works by setting a reactive input. See this article to learn about your options for doing that.
SHINY RUNJS JQUERY EXAMPLE HOW TO
In both cases, you’ll also need to know how to package your JavaScript code with your Shiny app.


You want the server to trigger logic on the client that doesn’t naturally relate to any single output.Inputs send values from the client to the server, and when the server has values for the client to display, they are received and rendered by outputs.īut sometimes, you may want some custom behavior in JavaScript that isn’t a natural fit for a custom input or output binding. Shiny was designed with an emphasis on distinct input and output components in the UI.
