shiny::selectInput("id", "label", c("A" = "a", "B" = "b", "C" = "c"),
selected = c("a", "b"), width = "200px",
multiple = TRUE
)
twSelectInput("id", "label", c("A" = "a", "B" = "b", "C" = "c"),
selected = c("a", "b"), width = "200px",
multiple = TRUE, selectize = TRUE,
container_class = "CONTAINER", label_class = "LABEL",
select_class = "SELECT"
)
# basic full shiny example
library(shiny)
ui <- fluidPage(
use_tailwind(),
twSelectInput(
"variable", "Variable to select:",
c("Cylinders" = "cyl", "Transmission" = "am", "Gears" = "gear"),
multiple = TRUE,
# Apply tailwind classes
container_class = "shadow-md rounded-md bg-gray-50 m-4 p-2 w-72",
label_class = "font-serif",
select_class = "font-mono font-bold text-red-800 rounded-md bg-stone-50"
),
tableOutput("data")
)
server <- function(input, output) {
output$data <- renderTable(
{
mtcars[, c("mpg", input$variable), drop = FALSE]
},
rownames = TRUE
)
}
if (interactive()) shiny::shinyApp(ui, server)
Run the code above in your browser using DataLab