Debian Codegraph @

man/sliderInput.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/input-slider.R
3 \name{sliderInput}
4 \alias{sliderInput}
5 \alias{animationOptions}
6 \title{Slider Input Widget}
7 \usage{
8 sliderInput(
9 inputId,
10 label,
11 min,
12 max,
13 value,
14 step = NULL,
15 round = FALSE,
16 ticks = TRUE,
17 animate = FALSE,
18 width = NULL,
19 sep = ",",
20 pre = NULL,
21 post = NULL,
22 timeFormat = NULL,
23 timezone = NULL,
24 dragRange = TRUE
25 )
26
27 animationOptions(
28 interval = 1000,
29 loop = FALSE,
30 playButton = NULL,
31 pauseButton = NULL
32 )
33 }
34 \arguments{
35 \item{inputId}{The \code{input} slot that will be used to access the value.}
36
37 \item{label}{Display label for the control, or \code{NULL} for no label.}
38
39 \item{min, max}{The minimum and maximum values (inclusive) that can be
40 selected.}
41
42 \item{value}{The initial value of the slider, either a number, a date
43 (class Date), or a date-time (class POSIXt). A length one vector will
44 create a regular slider; a length two vector will create a double-ended
45 range slider. Must lie between \code{min} and \code{max}.}
46
47 \item{step}{Specifies the interval between each selectable value on the
48 slider. Either \code{NULL}, the default, which uses a heuristic to determine the
49 step size or a single number. If the values are dates, \code{step} is in days;
50 if the values are date-times, \code{step} is in seconds.}
51
52 \item{round}{\code{TRUE} to round all values to the nearest integer;
53 \code{FALSE} if no rounding is desired; or an integer to round to that
54 number of digits (for example, 1 will round to the nearest 10, and -2 will
55 round to the nearest .01). Any rounding will be applied after snapping to
56 the nearest step.}
57
58 \item{ticks}{\code{FALSE} to hide tick marks, \code{TRUE} to show them
59 according to some simple heuristics.}
60
61 \item{animate}{\code{TRUE} to show simple animation controls with default
62 settings; \code{FALSE} not to; or a custom settings list, such as those
63 created using \code{\link[=animationOptions]{animationOptions()}}.}
64
65 \item{width}{The width of the input, e.g. \code{'400px'}, or \code{'100\%'};
66 see \code{\link[=validateCssUnit]{validateCssUnit()}}.}
67
68 \item{sep}{Separator between thousands places in numbers.}
69
70 \item{pre}{A prefix string to put in front of the value.}
71
72 \item{post}{A suffix string to put after the value.}
73
74 \item{timeFormat}{Only used if the values are Date or POSIXt objects. A time
75 format string, to be passed to the Javascript strftime library. See
76 \url{https://github.com/samsonjs/strftime} for more details. The allowed
77 format specifications are very similar, but not identical, to those for R's
78 \code{\link[base:strptime]{base::strftime()}} function. For Dates, the default is \code{"\%F"}
79 (like \code{"2015-07-01"}), and for POSIXt, the default is \code{"\%F \%T"}
80 (like \code{"2015-07-01 15:32:10"}).}
81
82 \item{timezone}{Only used if the values are POSIXt objects. A string
83 specifying the time zone offset for the displayed times, in the format
84 \code{"+HHMM"} or \code{"-HHMM"}. If \code{NULL} (the default), times will
85 be displayed in the browser's time zone. The value \code{"+0000"} will
86 result in UTC time.}
87
88 \item{dragRange}{This option is used only if it is a range slider (with two
89 values). If \code{TRUE} (the default), the range can be dragged. In other
90 words, the min and max can be dragged together. If \code{FALSE}, the range
91 cannot be dragged.}
92
93 \item{interval}{The interval, in milliseconds, between each animation step.}
94
95 \item{loop}{\code{TRUE} to automatically restart the animation when it
96 reaches the end.}
97
98 \item{playButton}{Specifies the appearance of the play button. Valid values
99 are a one-element character vector (for a simple text label), an HTML tag
100 or list of tags (using \code{\link[=tag]{tag()}} and friends), or raw HTML (using
101 \code{\link[=HTML]{HTML()}}).}
102
103 \item{pauseButton}{Similar to \code{playButton}, but for the pause button.}
104 }
105 \description{
106 Constructs a slider widget to select a number, date, or date-time from a
107 range.
108 }
109 \section{Server value}{
110
111 A number, date, or date-time (depending on the class of \code{value}), or
112 in the case of slider range, a vector of two numbers/dates/date-times.
113 }
114
115 \examples{
116 ## Only run examples in interactive R sessions
117 if (interactive()) {
118 options(device.ask.default = FALSE)
119
120 ui <- fluidPage(
121 sliderInput("obs", "Number of observations:",
122 min = 0, max = 1000, value = 500
123 ),
124 plotOutput("distPlot")
125 )
126
127 # Server logic
128 server <- function(input, output) {
129 output$distPlot <- renderPlot({
130 hist(rnorm(input$obs))
131 })
132 }
133
134 # Complete app with UI and server components
135 shinyApp(ui, server)
136 }
137
138 }
139 \seealso{
140 \code{\link[=updateSliderInput]{updateSliderInput()}}
141
142 Other input elements:
143 \code{\link{actionButton}()},
144 \code{\link{checkboxGroupInput}()},
145 \code{\link{checkboxInput}()},
146 \code{\link{dateInput}()},
147 \code{\link{dateRangeInput}()},
148 \code{\link{fileInput}()},
149 \code{\link{numericInput}()},
150 \code{\link{passwordInput}()},
151 \code{\link{radioButtons}()},
152 \code{\link{selectInput}()},
153 \code{\link{submitButton}()},
154 \code{\link{textAreaInput}()},
155 \code{\link{textInput}()},
156 \code{\link{varSelectInput}()}
157 }
158 \concept{input elements}