twVarSelectizeInput {shiny.tailwind}R Documentation

Wrapper around shiny::varSelectizeInput() but allowing for more classes

Description

Note that the colors for the selected elements can be customized. c.f. 05-apply-directive example app

Usage

twVarSelectizeInput(
  inputId,
  ...,
  options = NULL,
  width = NULL,
  container_class = NULL,
  label_class = NULL,
  input_class = NULL,
  label_after_input = FALSE
)

Arguments

inputId

The input slot that will be used to access the value.

...

Arguments passed to varSelectInput().

options

A list of options. See the documentation of selectize.js for possible options (character option values inside base::I() will be treated as literal JavaScript code; see renderDataTable() for details).

width

The width of the input, e.g. '400px', or '100%'; see validateCssUnit().

container_class

additional classes to be applied to the container

label_class

additional classes to be applied to the label

input_class

additional classes to be applied to the input element

label_after_input

TRUE/FALSE if the label should be put after the input box. Default is FALSE. Useful for special cases (floating labels), c.f. 05-apply-directive example app.

Value

a list with a shiny.tag class

See Also

shiny::varSelectizeInput()

Examples

shiny::varSelectizeInput("selectize", "A Selection", mtcars)
twVarSelectizeInput("selectize", "A Selection", mtcars,
  container_class = "CONTAINER", label_class = "LABEL",
  input_class = "INPUT"
)

# basic full shiny example
library(shiny)

ui <- fluidPage(
  use_tailwind(),
  twVarSelectizeInput(
    "values", "A Selection", mtcars,
    multiple = TRUE,
    # Apply tailwind classes
    container_class = "w-48 m-4 p-2 border border-gray-200 rounded-md drop-shadow-md",
    label_class = "font-mono text-gray-600",
    input_class = "drop-shadow-lg text-gray-600 font-mono rounded-md border-amber-400"
  ),
  verbatimTextOutput("value")
)

server <- function(input, output) {
  output$value <- renderText({
    as.character(input$values)
  })
}

if (interactive()) shiny::shinyApp(ui_basic, server)

[Package shiny.tailwind version 0.2.2 Index]