Title: | Some Datetime Pickers for 'Shiny' |
Version: | 1.2.0 |
Description: | Provides three types of datetime pickers for usage in a 'Shiny' UI. A datetime picker is an input field for selecting both a date and a time. |
License: | GPL-3 |
URL: | https://github.com/stla/shinyDatetimePickers |
BugReports: | https://github.com/stla/shinyDatetimePickers/issues |
Imports: | htmltools, lubridate, reactR, shiny |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
NeedsCompilation: | no |
Packaged: | 2024-04-23 00:15:34 UTC; SDL96354 |
Author: | Stéphane Laurent [aut, cre], Wojciech Maj [cph] ('react-datetime-picker' library (https://github.com/wojtekmaj/react-datetime-picker)), Porinn [cph] ('react-datetime-slider-picker' library (https://github.com/Porinn/react-datetime-slider-picker)), Dmitriy Kovalenko [cph] ('material-ui-pickers' library (https://github.com/mui-org/material-ui-pickers)) |
Maintainer: | Stéphane Laurent <laurent_step@outlook.fr> |
Repository: | CRAN |
Date/Publication: | 2024-04-23 07:40:03 UTC |
Material design datetime picker
Description
A datetime picker for a Shiny UI.
Usage
datetimeMaterialPickerInput(
inputId,
label = NULL,
value = NULL,
disablePast = FALSE,
disableFuture = FALSE,
style = NULL
)
Arguments
inputId |
the input slot that will be used to access the value |
label |
a label, a character string (HTML is not allowed), or
|
value |
initial value, either a |
disablePast |
logical, whether to disable past dates |
disableFuture |
logical, whether to disable future dates |
style |
inline CSS for the container |
Value
A shiny.tag
object that can be included in a Shiny UI.
Examples
if(interactive()){
library(shinyDatetimePickers)
library(shiny)
ui <- fluidPage(
br(),
sidebarLayout(
sidebarPanel(
datetimeMaterialPickerInput(
"dtmpicker",
label = "Appointment",
disablePast = TRUE
)
),
mainPanel(
verbatimTextOutput("dtmpicker")
)
)
)
server <- function(input, output){
output[["dtmpicker"]] <- renderPrint({
input[["dtmpicker"]]
})
}
shinyApp(ui, server)
}
Datetime picker
Description
A datetime picker for a Shiny UI.
Usage
datetimePickerInput(inputId, value = NULL, style = NULL)
Arguments
inputId |
the input slot that will be used to access the value |
value |
initial value, either a |
style |
inline CSS for the container |
Value
A shiny.tag
object that can be included in a Shiny UI.
Examples
if(interactive()){
library(shinyDatetimePickers)
library(shiny)
ui <- fluidPage(
br(),
sidebarLayout(
sidebarPanel(
tags$fieldset(
tags$legend("Click to change time"),
datetimePickerInput(
"dtpicker",
style =
"font-family: Montserrat, 'Segoe UI', Tahoma, sans-serif;"
)
)
),
mainPanel(
verbatimTextOutput("dtpicker")
)
)
)
server <- function(input, output){
output[["dtpicker"]] <- renderPrint({
input[["dtpicker"]]
})
}
shinyApp(ui, server)
}
Datetime picker with sliders
Description
A datetime picker for a Shiny UI.
Usage
datetimeSliderPickerInput(inputId, value = NULL, second = FALSE, save = FALSE)
Arguments
inputId |
the input slot that will be used to access the value |
value |
initial value, either a |
second |
logical, whether to enable the second picker |
save |
logical, whether to enable the 'save' button |
Value
A shiny.tag
object that can be included in a Shiny UI.
Examples
if(interactive()){
library(shinyDatetimePickers)
library(shiny)
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
actionButton("setdt", label = as.character(Sys.time()),
class = "btn-info")
),
mainPanel()
)
)
server <- function(input, output, session){
datetime <- reactiveVal(Sys.time())
observeEvent(input[["setdt"]], {
showModal(modalDialog(
datetimeSliderPickerInput("dtspicker", save = TRUE, value = datetime())
))
})
observeEvent(input[["dtspicker_save"]], {
datetime(input[["dtspicker"]])
removeModal()
updateActionButton(session, "setdt",
label = as.character(input[["dtspicker"]]))
})
}
shinyApp(ui, server)
}
Update a datetime material picker widget
Description
Change the value of a datetime material picker input.
Usage
updateDatetimeMaterialPickerInput(session, inputId, value)
Arguments
session |
the Shiny |
inputId |
the id of the datetime material picker widget to be updated |
value |
new value for the datetime material picker widget |
Value
No returned value, this just updates the widget.
Update a datetime picker widget
Description
Change the value of a datetime picker input.
Usage
updateDatetimePickerInput(session, inputId, value)
Arguments
session |
the Shiny |
inputId |
the id of the datetime picker widget to be updated |
value |
new value for the datetime picker widget |
Value
No returned value, this just updates the widget.
Update a datetime slider picker widget
Description
Change the value of a datetime slider picker input.
Usage
updateDatetimeSliderPickerInput(session, inputId, value)
Arguments
session |
the Shiny |
inputId |
the id of the datetime slider picker widget to be updated |
value |
new value for the datetime slider picker widget |
Value
No returned value, this just updates the widget.