Build interactive calendar with the JavaScript tui-calendar library.
Usage
calendar(
data = NULL,
view = c("month", "week", "day"),
defaultDate = NULL,
useDetailPopup = TRUE,
useCreationPopup = FALSE,
isReadOnly = TRUE,
navigation = FALSE,
navOpts = navigation_options(),
...,
width = NULL,
height = NULL,
elementId = NULL
)
Arguments
- data
A
data.frame
with schedules data, seecal_demo_data()
.- view
Default view of calendar. The default value is 'week', other possible values are 'month' and 'day'.
- defaultDate
Default date for displaying calendar.
- useDetailPopup
Logical. Display a pop-up on click with detailed informations about schedules.
- useCreationPopup
Logical. Allow user to create schedules with a pop-up.
- isReadOnly
Calendar is read-only mode and a user can't create and modify any schedule. The default value is true.
Add navigation buttons to got to previous or next period, or return to 'today'.
Options to customize buttons (only if
navigation = TRUE
), seenavigation_options()
.- ...
Additional arguments passed to JavaScript method.
- width, height
A numeric input in pixels.
- elementId
Use an explicit element ID for the widget.
Note
taskView
and scheduleView
arguments have been moved to cal_week_options()
.
See also
calendarOutput()
/ renderCalendar()
for usage in Shiny applications.
Examples
# Default: monthly view
calendar()
# Weekly view
calendar(view = "week")
# Or only day:
calendar(view = "day")
# Add navigation buttons
calendar(navigation = TRUE)
# Add schedules data
ex_data <- cal_demo_data()
calendar(ex_data)
# By default detail popup is activated
# you can click on a schedule to view detail
calendar(useDetailPopup = TRUE) %>%
cal_schedules(
title = "My schedule",
body = "Some detail about it",
start = format(Sys.Date(), "%Y-%m-03"),
end = format(Sys.Date(), "%Y-%m-04"),
category = "allday"
)
# to disable it use useDetailPopup = FALSE
# You can use HTML tags inside it:
library(htmltools)
calendar(useDetailPopup = TRUE) %>%
cal_schedules(
title = "My schedule",
body = doRenderTags(tags$div(
tags$h3("Title for my schedule"),
tags$p(
"Yan can write", tags$em("custom"), tags$b("HTML"),
"in a popup !"
),
tags$p(
style = "color: firebrick;",
"For example write in red !"
),
tags$ul(
tags$li("Or make a bullet list!"),
tags$li("With another item"),
tags$li("And one more")
)
)),
start = format(Sys.Date(), "%Y-%m-03"),
end = format(Sys.Date(), "%Y-%m-04"),
category = "allday"
)