twNumericInput {shiny.tailwind}R Documentation

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

Description

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

Usage

twNumericInput(
  inputId,
  label,
  value,
  min = NA,
  max = NA,
  step = NA,
  width = NULL,
  placeholder = "",
  disabled = FALSE,
  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.

label

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

value

Initial value.

min

Minimum allowed value

max

Maximum allowed value

step

Interval to use when stepping between min and max

width

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

placeholder

Placeholder text for numeric input. Disappears after input

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

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. 04-shiny-inputs example app.

Value

a list with a shiny.tag class

See Also

shiny::numericInput()

Examples

shiny::numericInput("number", "A Number", 42, min = 10, max = 100, step = 13, width = "200px")
twNumericInput("number", "A Number", 42,
  min = 10, max = 100, step = 13, width = "200px",
  container_class = "CONTAINER", label_class = "LABEL", input_class = "INPUT"
)

# basic full shiny example
library(shiny)

ui <- fluidPage(
  use_tailwind(),
  twNumericInput(
    "number", "A Number", 123456,
    # 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({
    input$number
  })
}

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

[Package shiny.tailwind version 0.2.2 Index]