Calendar

A full-featured event calendar with month and week views, event chips, selectable dates, event-detail popovers, week numbers, and a complete JavaScript navigation API.

Full-featured Calendar with Popovers

Click any event chip to open a detail popover. Month / Week view switcher and Today navigation in the header. Events on the same day stack; overflow shows a "+N more" badge.

Click a date to see the selection…
PHP

Week View

The week view shows a single 7-day strip with full-day event chips. Navigates one week at a time.

PHP

With ISO Week Numbers

ISO 8601 week numbers in a narrow gutter on the left. Useful for production schedules and editorial planning.

PHP

Selectable with Date Constraints

Restrict which dates can be selected with minDate() and maxDate(). Disabled dates render at reduced opacity. The selected date is reported below.

No date selected yet…
PHP

Read-only Display

Without selectable(), the calendar is a pure display widget — no hover cursor, no selection state. Ideal for embedding on public-facing pages.

PHP

PHP PHP Methods (Fluent)

Method / PropertyParametersDescription
$m->calendar($id)string $idCreate a Calendar instance.
->events($events)arraySet all events. Each event: date (YYYY-MM-DD, required), title, type, color, description, url.
->addEvent($event)arrayAppend a single event.
->view($view)stringInitial view. Default: 'month'. Accepted: 'month', 'week'.
->initialDate($date)string YYYY-MM-DDDate to display on first render. Defaults to today.
->selectable()bool = trueAllow clicking dates. Fires m:calendar:dateclick.
->highlightToday()bool = trueFill today's date number with a primary-colour circle. Default: on.
->weekStartsMonday()bool = trueStart columns on Monday instead of Sunday.
->showWeekNumbers()bool = trueShow ISO 8601 week numbers in the left gutter.
->withPopover()bool = trueShow an event-detail popover when an event chip is clicked.
->minDate($date)string YYYY-MM-DDEarliest date that can be viewed or selected.
->maxDate($date)string YYYY-MM-DDLatest date that can be viewed or selected.
->height($css)stringFixed height for calendar rows (e.g. '200px'). Default: fluid.

JS JS Methods

Method / PropertyParametersDescription
m.calendar(id)Get the Calendar API instance. Returns null if element not found.
.view('month'|'week')stringSwitch the current view and re-render.
.goTo(dateStr)string YYYY-MM-DDNavigate to the period containing the given date.
.today()Jump to today's month.
.prev()Navigate back one month (or one week in week view).
.next()Navigate forward one month (or one week in week view).
.setEvents(events)ArrayReplace all events and re-render.
.addEvent(event)ObjectAppend one event and re-render.
.clearEvents()Remove all events and re-render.
.selected()Returns the currently selected date string (YYYY-MM-DD), or null.

EVENT Events

Event NameDetailDescription
m:calendar:dateclick{ date, events }Fired when a selectable date cell is clicked. date is YYYY-MM-DD; events is the array of events on that day.
m:calendar:eventclick{ event, date }Fired when an event chip is clicked. event is the full event object.
m:calendar:navigate{ year, month, view }Fired after the calendar navigates to a new period.