twCheckboxInput {shiny.tailwind}R Documentation

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

Description

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

Usage

twCheckboxInput(
  inputId,
  label,
  value = FALSE,
  width = NULL,
  disabled = FALSE,
  container_class = NULL,
  label_class = NULL,
  input_class = NULL,
  center = FALSE
)

Arguments

inputId

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

label

Display label for the control, or NULL for no label.

value

Initial value (TRUE or FALSE).

width

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

disabled

if the user should not be able to interact with the field

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

center

if a margin of 0px !important should be applied, effectively removing bootstrap styling (if applied) to center the checkbox easier

Value

a list with a shiny.tag class

See Also

shiny::checkboxInput()

Examples

shiny::checkboxInput("id", "label", value = FALSE)
twCheckboxInput("id", "label",
  value = TRUE, width = "200px", disabled = TRUE,
  container_class = "CONTAINER", label_class = "LABEL", input_class = "INPUT"
)

# basic full shiny example
library(shiny)

ui <- fluidPage(
  use_tailwind(),
  twCheckboxInput(
    "chk", "Check me!",
    value = TRUE,
    container_class = "w-48 m-4 p-2 border border-gray-200 rounded-md drop-shadow-md",
    label_class = "font-serif text-gray-600",
    input_class = "text-pink-500 focus:ring-pink-500",
    center = TRUE
  ),
  verbatimTextOutput("out")
)

server <- function(input, output) {
  output$out <- renderText({
    input$chk
  })
}

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

[Package shiny.tailwind version 0.2.2 Index]