CalendarComponent (Event Calendar Component v0.3.0)

Copy Markdown View Source

Phoenix components for EventCalendar.

The HEEx components live in LiveCalendar.Components. This module provides helpers to drive a LiveView calendar from the server.

Summary

Functions

Returns the version of EventCalendar bundled with this library.

Runs a calendar method on the client from a LiveView.

Functions

event_calendar_version()

@spec event_calendar_version() :: String.t()

Returns the version of EventCalendar bundled with this library.

iex> CalendarComponent.event_calendar_version()
"5.17.2"

push_command(socket, calendar_id, command, args \\ [])

Runs a calendar method on the client from a LiveView.

calendar_id is the id given to LiveCalendar.Components.calendar/1.

Supported commands:

  • :goto_date - [date], a Date, DateTime or ISO8601 string
  • :next, :prev, :today
  • :refetch_events, :refetch_resources - reload eventSources / resources given as URLs
  • :unselect - clears the current selection
  • :set_option - [name, value], sets any EventCalendar option

Examples

socket
|> CalendarComponent.push_command("calendar", :goto_date, [~D[2026-12-01]])
|> CalendarComponent.push_command("calendar", :set_option, ["view", "timeGridWeek"])