dropInput | R Documentation |
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
)
inputId |
The |
choicesNames |
A |
choicesValues |
Vector corresponding to |
selected |
The initial selected value, must be an element of |
dropUp |
Open the menu above the button rather than below. |
dropWidth |
Width of the dropdown menu. |
dropMaxHeight |
Maximal height for the menu. |
dropPreScrollable |
Force scroll bar to appear in the menu. |
btnClass |
Class for buttons in dropdown menu, default is |
width |
The width of the input. |
updateDropInput
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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.