View source: R/input-numericRange.R
updateNumericRangeInput | R Documentation |
Change the value of a numeric range input
updateNumericRangeInput(
session = getDefaultReactiveDomain(),
inputId,
label = NULL,
value = NULL
)
session |
The session object passed to function given to shinyServer. |
inputId |
The |
label |
Display label for the control, or |
value |
The initial value(s) for the range. A numeric vector of length one will be duplicated to represent the minimum and maximum of the range; a numeric vector of two or more will have its minimum and maximum set the minimum and maximum of the range. |
numericRangeInput()
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
tags$br(),
numericRangeInput(
inputId = "my_id",
label = "Numeric Range Input:",
value = c(100, 400)
),
verbatimTextOutput(outputId = "res1"),
textInput("label", "Update label:"),
numericInput("val1", "Update value 1:", 100),
numericInput("val2", "Update value 2:", 400)
)
server <- function(input, output, session) {
output$res1 <- renderPrint(input$my_id)
observeEvent(input$label, {
updateNumericRangeInput(
session = session,
inputId = "my_id",
label = input$label
)
}, ignoreInit = TRUE)
observe({
updateNumericRangeInput(
session = session,
inputId = "my_id",
value = c(input$val1, input$val2)
)
})
}
if (interactive())
shinyApp(ui, server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.