calendar-shiny {toastui}R Documentation

Shiny bindings for calendar()

Description

Output and render functions for using calendar() within Shiny applications and interactive Rmd documents.

Usage

calendarOutput(outputId, width = "100%", height = "600px")

renderCalendar(expr, env = parent.frame(), quoted = FALSE)

Arguments

outputId

Output variable to read from.

width, height

Must be a valid CSS unit (like ⁠100%⁠, ⁠400px⁠, auto) or a number, which will be coerced to a string and have px appended.

expr

An expression that generates a calendar

env

The environment in which to evaluate expr.

quoted

Is expr a quoted expression (with quote())? This is useful if you want to save an expression in a variable.

Value

Output element that can be included in UI. Render function to create output in server.

Special inputs

The following input values will be accessible in the server:

To use them you need to replace outputId by the id you've used to create the calendar. If you use one of the above javascript event in cal_events(), the input won't be accessible.

Examples

library(shiny)
library(toastui)

ui <- fluidPage(
  tags$h2("calendar shiny example"),
  fluidRow(
    column(
      width = 8,
      calendarOutput("my_calendar")
    ),
    column(
      width = 4,
      tags$b("Dates:"),
      verbatimTextOutput("dates"),
      tags$b("Clicked schedule:"),
      verbatimTextOutput("click")
    )
  )
)

server <- function(input, output, session) {

  output$my_calendar <- renderCalendar({
    calendar(cal_demo_data(), navigation = TRUE) %>%
      cal_props(
        list(
          id = 1,
          name = "PERSO",
          color = "white",
          bgColor = "firebrick",
          borderColor = "firebrick"
        ),
        list(
          id = 2,
          name = "WORK",
          color = "white",
          bgColor = "forestgreen",
          borderColor = "forestgreen"
        )
      )
  })

  output$dates <- renderPrint({
    input$my_calendar_dates
  })

  output$click <- renderPrint({
    input$my_calendar_click
  })

}

if (interactive())
  shinyApp(ui, server)

[Package toastui version 0.3.3 Index]