Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

update_dropdown_input

Update dropdown Semantic UI component


Description

Change the value of a dropdown_input input on the client.

Usage

update_dropdown_input(
  session,
  input_id,
  choices = NULL,
  choices_value = choices,
  value = NULL
)

Arguments

session

The session object passed to function given to shinyServer.

input_id

The id of the input object

choices

All available options one can select from. If no need to update then leave as NULL

choices_value

What reactive value should be used for corresponding choice.

value

The initially selected value.

Examples

if (interactive()) {

library(shiny)
library(shiny.semantic)

ui <- function() {
  shinyUI(
    semanticPage(
      title = "Dropdown example",
      dropdown_input("simple_dropdown", LETTERS[1:5], value = "A", type = "selection multiple"),
      p("Selected letter:"),
      textOutput("selected_letter"),
      shiny.semantic::actionButton("simple_button", "Update input to D")
    )
  )
}

server <- shinyServer(function(input, output, session) {
  output$selected_letter <- renderText(paste(input[["simple_dropdown"]], collapse = ", "))

  observeEvent(input$simple_button, {
    update_dropdown(session, "simple_dropdown", value = "D")
  })
})

shinyApp(ui = ui(), server = server)

}

shiny.semantic

Semantic UI Support for Shiny

v0.4.2
MIT + file LICENSE
Authors
Filip Stachura [aut], Dominik Krzeminski [cre], Krystian Igras [aut], Adam Forys [aut], Paweł Przytuła [aut], Jakub Chojna [aut], Olga Mierzwa-Sulima [aut], Ashley Baldry [ctb], Jakub Chojna [ctb], Olga Mierzwa-Sulima [ctb], Pedro Manuel Coutinho da Silva [ctb], Paweł Przytuła [ctb], Kamil Żyła [ctb], Rabii Bouhestine [ctb], Appsilon Sp. z o.o. [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.