A dropdown menu for selecting a value.
dropInput(inputId, choicesNames, choicesValues, selected = NULL,
dropUp = FALSE, dropWidth = NULL, dropMaxHeight = NULL,
dropPreScrollable = FALSE, btnClass = "btn-link", width = NULL)
The input
slot that will be used to access the value.
A tagList
of HTML tags to show in the dropdown menu.
Vector corresponding to choicesNames
for retrieving values server-side.
The initial selected value, must be an element of choicesValues
,
default to the first item of choicesValues
.
Open the menu above the button rather than below.
Width of the dropdown menu.
Maximal height for the menu.
Force scroll bar to appear in the menu.
Class for buttons in dropdown menu, default is "btn-link"
,
you can use for example "btn-default"
to display regular buttons.
The width of the input.
# NOT RUN {
if (interactive()) {
library(shiny)
library(esquisse)
ui <- fluidPage(
tags$h2("Drop Input"),
dropInput(
inputId = "mydrop",
choicesNames = tagList(
list(icon("home"), style = "width: 100px;"),
list(icon("flash"), style = "width: 100px;"),
list(icon("cogs"), style = "width: 100px;"),
list(icon("fire"), style = "width: 100px;"),
list(icon("users"), style = "width: 100px;"),
list(icon("info"), style = "width: 100px;")
),
choicesValues = c("home", "flash", "cogs",
"fire", "users", "info"),
dropWidth = "220px"
),
verbatimTextOutput(outputId = "res")
)
server <- function(input, output, session) {
output$res <- renderPrint({
input$mydrop
})
}
shinyApp(ui, server)
}
# }
Run the code above in your browser using DataLab