Learn R Programming

shiny.semantic (version 0.2.0)

search_selection_choices: Add Semantic UI search selection dropdown based on provided choices

Description

Define the (multiple) search selection dropdown input component serving search options using provided choices.

Usage

search_selection_choices(name, choices, value = NULL, multiple = FALSE,
  default_text = "Select")

Arguments

name

Input name. Reactive value is available under input[[name]].

choices

Vector or a list of choices to search through.

value

String with default values to set when initialize the component. Values should be delimited wirh a comma when multiple to set. Default NULL.

multiple

TRUE if the dropdown should allow multiple selections, FALSE otherwise (default FALSE).

default_text

Text to be visible on dropdown when nothing is selected.

Examples

Run this code
# NOT RUN {
## Only run examples in interactive R sessions
if (interactive()) {
  library(shiny)
  library(shiny.semantic)

  ui <- function() {
    shinyUI(
      semanticPage(
        title = "Dropdown example",
        uiOutput("search_letters"),
        p("Selected letter:"),
        textOutput("selected_letters")
      )
    )
  }

  server <- shinyServer(function(input, output, session) {
    choices <- LETTERS
    output$search_letters <- shiny::renderUI(
      search_selection_choices("search_result", choices, multiple = TRUE)
    )
    output$selected_letters <- renderText(input[["search_result"]])
  })

  shinyApp(ui = ui(), server = server)
}
# }

Run the code above in your browser using DataLab