numberInput: Create a numeric input

Description Usage Arguments Value Server value See Also Examples

View source: R/numberInput.R

Description

Create an input control for entry of numeric values. This is identical to shiny::numericInput() but is more flexible in not requiring an initial value and in allowing placeholders.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
numberInput(
  inputId,
  label,
  value = NULL,
  min = NA,
  max = NA,
  step = NA,
  placeholder = NULL,
  width = NULL
)

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. NULL by default.

min

Minimum allowed value

max

Maximum allowed value

step

Interval to use when stepping between min and max

placeholder

A character string giving the user a hint as to what can be entered into the control. Internet Explorer 8 and 9 do not support this option.

width

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

Value

A numeric input control that can be added to a UI definition.

Server value

A numeric vector of length 1.

See Also

shiny::updateNumericInput()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
if (interactive()) {
library(shiny)
library(shinysurveys)

ui <- fluidPage(
  numberInput("obs", "Observations:", placeholder = "How many do you see?", min = 1, max = 100),
  verbatimTextOutput("value")
)
server <- function(input, output) {
  output$value <- renderText({ input$obs })
}
shinyApp(ui, server)
}

shinysurveys documentation built on July 11, 2021, 9:06 a.m.