valueButton.Rd
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,
...
)
Id of the button. The value can be accessed in server with `input[[inputId]]`.
Button label.
CSS selector of element the attribute should be taken from. Set `"window"` or `"document"` to access application `window` or `document` object.
Name of the attribute that should be taken from desired element. For nested properties use `.`, e.g. `style.width` or `navigator.appName`.
Icon included in button.
Width of the button.
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))
}
)
}