Each function sets the current value of a bound shadshiny input, mirroring
Shiny's built-in update*Input() helpers. Changing the available choices
of a component is a non-goal – re-render with shiny::renderUI() instead.
Usage
update_shad_checkbox(id, value, session = shiny::getDefaultReactiveDomain())
update_shad_radio_group(
id,
selected,
session = shiny::getDefaultReactiveDomain()
)
update_shad_switch(id, value, session = shiny::getDefaultReactiveDomain())
update_shad_slider(id, value, session = shiny::getDefaultReactiveDomain())
update_shad_toggle(id, value, session = shiny::getDefaultReactiveDomain())
update_shad_toggle_group(
id,
selected,
session = shiny::getDefaultReactiveDomain()
)
update_shad_select(id, selected, session = shiny::getDefaultReactiveDomain())
update_shad_combobox(
id,
selected,
multiple = FALSE,
session = shiny::getDefaultReactiveDomain()
)
update_shad_input_otp(id, value, session = shiny::getDefaultReactiveDomain())
update_shad_native_select(
id,
selected,
session = shiny::getDefaultReactiveDomain()
)
update_shad_calendar(id, value, session = shiny::getDefaultReactiveDomain())
update_shad_date_picker(id, value, session = shiny::getDefaultReactiveDomain())
update_shad_tabs(id, selected, session = shiny::getDefaultReactiveDomain())
update_shad_accordion(id, value, session = shiny::getDefaultReactiveDomain())
update_shad_collapsible(id, open, session = shiny::getDefaultReactiveDomain())
update_shad_resizable(id, sizes, session = shiny::getDefaultReactiveDomain())
update_shad_pagination(
id,
selected,
session = shiny::getDefaultReactiveDomain()
)
update_shad_carousel(id, selected, session = shiny::getDefaultReactiveDomain())
update_shad_sidebar(
id,
collapsed = NULL,
mobile_open = NULL,
active = NULL,
session = shiny::getDefaultReactiveDomain()
)
update_shad_progress(
id,
value,
max = 100,
session = shiny::getDefaultReactiveDomain()
)
update_shad_button(
id,
loading = NULL,
disabled = NULL,
label = NULL,
session = shiny::getDefaultReactiveDomain()
)Arguments
- id
The input id (namespaced automatically).
- value, selected
The new value. See each component's UI constructor for its value contract.
- session
The Shiny session.
- multiple
For
update_shad_combobox(), whether the combobox is in multiple mode (forces an array even for a single value).- open
For
update_shad_collapsible(), the logical open state.- sizes
For
update_shad_resizable(), the non-negative panel sizes.- collapsed, mobile_open, active
For
update_shad_sidebar();NULLleaves that facet unchanged.activeselects theshad_sidebar_item()with that value, so navigating from elsewhere (a command palette, a link) moves the rail too.- max
For
update_shad_progress(), the maximum value.- loading, disabled, label
For
update_shad_button();NULLleaves that facet unchanged.
Details
update_shad_select() and update_shad_combobox() match selected
against the choices as strings, and NULL clears the input. A value that is
not one of the choices is ignored and the browser console says so; in
multiple mode only the unknown entries are dropped.
update_shad_calendar() and update_shad_date_picker() take a Date or
an ISO "YYYY-MM-DD" string. A length-2 value sets a range and is put in
order; NULL or NA clears. A date outside the component's min / max
is ignored and the browser console says so; a range with one such end is
ignored whole. A date picker never opens, closes or takes focus because of a
server value.
See also
Other shadshiny server API:
bind_shad_task_button(),
shad_message_scroller_to_bottom(),
shad_overlay_server,
shad_remove_dialog(),
shad_show_dialog(),
shad_toast(),
update_shad_command()
Examples
if (interactive()) {
ui <- page_shad(
shad_switch("notify", "Email notifications", value = TRUE),
shad_slider("volume", "Volume", value = 20),
shad_select("size", "Size", choices = c("S", "M", "L")),
shad_button("Reset", inputId = "reset")
)
server <- function(input, output, session) {
shiny::observeEvent(input$reset, {
update_shad_switch("notify", FALSE)
update_shad_slider("volume", 50)
update_shad_select("size", "M")
update_shad_button("reset", label = "Reset again")
})
}
shiny::shinyApp(ui, server)
}