valueButton | R Documentation |
The components creates button or link that allows to take any value (or attribute) sourced from DOM element existing in Shiny application and pass it to application server.
valueButton( inputId, label, selector, attribute = "value", icon = NULL, width = NULL, try_binding = TRUE, ... ) valueLink( inputId, label, selector, attribute = "value", icon = NULL, try_binding = TRUE, ... )
inputId |
Id of the button. The value can be accessed in server with 'input[[inputId]]'. |
label |
Button label. |
selector |
CSS selector of element the attribute should be taken from. Set '"window"' or '"document"' to access application 'window' or 'document' object. |
attribute |
Name of the attribute that should be taken from desired element. For nested properties use '.', e.g. 'style.width' or 'navigator.appName'. |
icon |
Icon included in button. |
width |
Width of the button. |
try_binding |
When 'TRUE' and 'selector' points to Shiny Binding and 'attribute == "value"' it tries to convert sourced input value using registered 'inputHandler'. |
... |
Extra attributes passed to 'button' or 'a' tag. |
A 'shiny.tag' class object defining html structure of the button.
if (interactive()) { library(shiny) shinyApp( ui = fluidPage( tags$textarea(id = "txt"), valueButton("val", "Take textarea value", "#txt", attribute = "value") ), server = function(input, output, session) { observeEvent(input$val, print(input$val)) } ) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.