HTML select
HTMLSelect.Rd
Documentation: https://blueprintjs.com/docs/#core/components/html-select
Arguments
- ...
Component props and children. See the official Blueprint docs for details.
- inputId
The
input
slot that will be used to access the value.- value
Initial value.
Examples
library(shiny.blueprint)
library(shiny)
setInput <- function(inputId, accessor = NULL) {
JS(paste0("x => Shiny.setInputValue('", inputId, "', x", accessor, ")"))
}
options <- list(
list(value = "a", label = "Apples"),
list(value = "b", label = "Bananas"),
list(value = "c", label = "Cherries")
)
ui <- function(id) {
ns <- NS(id)
tagList(
HTMLSelect(
onChange = setInput(ns("choice1"), ".target.value"),
options = options
),
textOutput(ns("text1")),
br(),
HTMLSelect.shinyInput(
inputId = ns("choice2"),
value = "b",
options = options
),
textOutput(ns("text2"))
)
}
server <- function(id) {
moduleServer(id, function(input, output, session) {
output$text1 <- renderText(deparse(input$choice1))
output$text2 <- renderText(deparse(input$choice2))
})
}
if (interactive()) shinyApp(ui("app"), function(input, output) server("app"))