| wa_set_property | R Documentation |
Sends a one-way command from the Shiny server that sets a live browser-side
property on the element identified by DOM id.
wa_set_property(
id,
property,
value,
session = shiny::getDefaultReactiveDomain()
)
id |
DOM |
property |
Scalar property name to assign on the target element. |
value |
Value to assign. This should be serializable through Shiny's
custom-message transport. In practice, prefer JSON-like values such as
strings, numbers, logicals, |
session |
Shiny session object. Defaults to the current reactive domain. |
wa_set_property() is a narrow package-level escape hatch for advanced
cases where a Web Awesome component property needs to be updated from server
logic but is not covered by a generated update helper. It does not validate
whether the requested property exists for the targeted component.
This helper is complementary to generated component bindings and update helpers. It is not part of upstream component coverage and does not expand the generated per-component API surface.
On the server side, wa_set_property() validates only its R helper inputs,
such as the target id, property name, and session. It does not validate
whether the requested property exists on the browser-side element.
In the browser runtime, the command layer validates that the target DOM
id resolves to an element and that a property name was supplied, then
assigns the value directly. Command-layer warnings are controlled by the
package warning registry, especially the command_layer key. For option
details, see the Package Options article.
Invisibly returns NULL.
library(shiny)
library(shiny.webawesome)
ui <- webawesomePage(
wa_button("Open dialog", id = "open_dialog"),
wa_dialog("Dialog body", id = "dialog")
)
server <- function(input, output, session) {
observeEvent(input$open_dialog, {
wa_set_property("dialog", "open", TRUE, session = session)
})
}
app <- shinyApp(ui, server)
stopifnot(inherits(app, "shiny.appobj"))
# Run `app` interactively to launch this example application.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.