| dropdown {shiny.semantic} | R Documentation |
This creates a default dropdown using Semantic UI styles with Shiny input. Dropdown is already initialized and available under input[[name]].
dropdown(name, choices, choices_value = choices, default_text = "Select", value = NULL)
name |
Input name. Reactive value is available under input[[name]]. |
choices |
All available options one can select from. |
choices_value |
What reactive value should be used for corresponding choice. |
default_text |
Text to be visible on dropdown when nothing is selected. |
value |
Pass value if you want to initialize selection for dropdown. |
## Only run examples in interactive R sessions
if (interactive()) {
library(shiny)
library(shiny.semantic)
ui <- function() {
shinyUI(
semanticPage(
title = "Dropdown example",
suppressDependencies("bootstrap"),
uiOutput("dropdown"),
p("Selected letter:"),
textOutput("selected_letter")
)
)
}
server <- shinyServer(function(input, output) {
output$dropdown <- renderUI({
dropdown("simple_dropdown", LETTERS, value = "A")
})
output$selected_letter <- renderText(input[["simple_dropdown"]])
})
shinyApp(ui = ui(), server = server)
}