time_input: Creates a time input field

Description Usage Arguments Value Author(s) Examples

View source: R/time_input.R

Description

time_input creates a time input field for correctly formatted time values

update_time_input changes the value/label or placeholder of an time input element on the client side.

Usage

1
2
3
4
5
6
time_input(id, label, value = "", min = NULL, max = NULL,
  format = "HH:mm", placeholder = NULL, width = NULL, color = NULL,
  use_material_picker = FALSE)

update_time_input(session, id, label = NULL, value = NULL,
  min = NULL, max = NULL, placeholder = NULL)

Arguments

id

id of the element

label

label to show for the input, NULL for no label

value

initial value

min

minimum time value, must follow the specified format, e.g. "08:00"

max

maximum time value, must follow the specified format, e.g. "17:00"

format

format to use for the time string, can be any valid moment.js time format (NOTE: this will only work with the material time picker and can't be updated!)

placeholder

optional character specifying the placeholder text

width

optional, the width of the input, see validateCssUnit

color

color of the watch hand (of material time picker)

use_material_picker

boolean to specify if the input should be a simple time (text) input or use the bootstrap material time picker

session

the shiny session object

Value

time_input: shiny input element

update_time_input: message to the client

Author(s)

richard.kunze

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Only run examples in interactive R sessions
if (interactive()) {

library(shiny)
shinyApp(
  ui = fluidPage(
    fluidRow(
      column(3,
        time_input("time1", "Simple:", value = "12:34"),
        time_input("time2", "Fancy:", use_material_picker = TRUE),
        actionButton("update", "Update")
      )
    )
  ),
  server = function(input, output, session) {
    observeEvent(input$update, {
      update_time_input(session, "time2", value = "12:34")
    })
  }
)

}

dqshiny documentation built on May 2, 2019, 1:43 p.m.