Skip to content

onEventClick

Hears a click on an event — or Enter on a focused one.

Type(instance: EventInstance) => void
Defaultnot set
Live update (update())Yes
Declared inpackages/dom/src/settings.ts

It receives the event’s instance: instance.event (its id, title, start, end, props…) and, for an occurrence of a repeating event, which one. It is called for a click and for Enter (or Space) on a focused event, in every view — the “+N” panel and the list included. A click that ends a drag is not a click.

Nothing happens by default: open your own details, select the event in your page. For the context menu’s “Open”, see onEventOpen. Without onEventClick, Enter on a focused event in the grids, and a click or Enter in the list view, call onEventOpen instead; the “+N” panel calls only onEventClick.

import { createCalendar } from '@dzcalendar/dom';
createCalendar(element, {
timeZone: 'Europe/Paris',
onEventClick: (instance) => console.log(instance.event.id, instance.event.title, instance.event.start.toString()),
});

In the frameworks it is an output: Angular’s (eventClick), React’s onEventClick, Vue’s @event-click.