Debian Codegraph @

man/updateSliderInput.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/update-input.R
3 \name{updateSliderInput}
4 \alias{updateSliderInput}
5 \title{Update Slider Input Widget}
6 \usage{
7 updateSliderInput(
8 session = getDefaultReactiveDomain(),
9 inputId,
10 label = NULL,
11 value = NULL,
12 min = NULL,
13 max = NULL,
14 step = NULL,
15 timeFormat = NULL,
16 timezone = NULL
17 )
18 }
19 \arguments{
20 \item{session}{The \code{session} object passed to function given to
21 \code{shinyServer}. Default is \code{getDefaultReactiveDomain()}.}
22
23 \item{inputId}{The id of the input object.}
24
25 \item{label}{The label to set for the input object.}
26
27 \item{value}{The initial value of the slider, either a number, a date
28 (class Date), or a date-time (class POSIXt). A length one vector will
29 create a regular slider; a length two vector will create a double-ended
30 range slider. Must lie between \code{min} and \code{max}.}
31
32 \item{min, max}{The minimum and maximum values (inclusive) that can be
33 selected.}
34
35 \item{step}{Specifies the interval between each selectable value on the
36 slider. Either \code{NULL}, the default, which uses a heuristic to determine the
37 step size or a single number. If the values are dates, \code{step} is in days;
38 if the values are date-times, \code{step} is in seconds.}
39
40 \item{timeFormat}{Only used if the values are Date or POSIXt objects. A time
41 format string, to be passed to the Javascript strftime library. See
42 \url{https://github.com/samsonjs/strftime} for more details. The allowed
43 format specifications are very similar, but not identical, to those for R's
44 \code{\link[base:strptime]{base::strftime()}} function. For Dates, the default is \code{"\%F"}
45 (like \code{"2015-07-01"}), and for POSIXt, the default is \code{"\%F \%T"}
46 (like \code{"2015-07-01 15:32:10"}).}
47
48 \item{timezone}{Only used if the values are POSIXt objects. A string
49 specifying the time zone offset for the displayed times, in the format
50 \code{"+HHMM"} or \code{"-HHMM"}. If \code{NULL} (the default), times will
51 be displayed in the browser's time zone. The value \code{"+0000"} will
52 result in UTC time.}
53 }
54 \description{
55 Change the value of a slider input on the client.
56 }
57 \details{
58 The input updater functions send a message to the client, telling it to
59 change the settings of an input object. The messages are collected and sent
60 after all the observers (including outputs) have finished running.
61
62 The syntax of these functions is similar to the functions that created the
63 inputs in the first place. For example, \code{\link{numericInput}()} and
64 \code{updateNumericInput()} take a similar set of arguments.
65
66 Any arguments with NULL values will be ignored; they will not result in any
67 changes to the input object on the client.
68
69 For \code{\link{radioButtons}()}, \code{\link{checkboxGroupInput}()} and
70 \code{\link{selectInput}()}, the set of choices can be cleared by using
71 \code{choices=character(0)}. Similarly, for these inputs, the selected item
72 can be cleared by using \code{selected=character(0)}.
73 }
74 \examples{
75 ## Only run this example in interactive R sessions
76 if (interactive()) {
77 shinyApp(
78 ui = fluidPage(
79 sidebarLayout(
80 sidebarPanel(
81 p("The first slider controls the second"),
82 sliderInput("control", "Controller:", min=0, max=20, value=10,
83 step=1),
84 sliderInput("receive", "Receiver:", min=0, max=20, value=10,
85 step=1)
86 ),
87 mainPanel()
88 )
89 ),
90 server = function(input, output, session) {
91 observe({
92 val <- input$control
93 # Control the value, min, max, and step.
94 # Step size is 2 when input value is even; 1 when value is odd.
95 updateSliderInput(session, "receive", value = val,
96 min = floor(val/2), max = val+4, step = (val+1)\%\%2 + 1)
97 })
98 }
99 )
100 }
101 }
102 \seealso{
103 \code{\link[=sliderInput]{sliderInput()}}
104 }