---
title: "Javascript Event calendar Event Popover Example | Mobiscroll"
component: "Event calendar"
framework: "JavaScript"
library_version: "6.1.5"
url: "https://demo.mobiscroll.com/javascript/eventcalendar/event-popover"
---

# Event Popover - JavaScript Event calendar demo

Keep the month grid clean in a Javascript event calendar — day cells show a dot or event count, and clicking opens a popover listing that day's events. Plain JS api for usage everywhere.

- [Live demo](https://demo.mobiscroll.com/javascript/eventcalendar/event-popover)
- [View code on GitHub](https://github.com/acidb/mobiscroll-demos-javascript/tree/main/src/demos/eventcalendar/calendar-view/event-popover)
- This demo in other frameworks: [jQuery](https://demo.mobiscroll.com/jquery/eventcalendar/event-popover.md), [Angular](https://demo.mobiscroll.com/angular/eventcalendar/event-popover.md), [React](https://demo.mobiscroll.com/react/eventcalendar/event-popover.md), [Vue](https://demo.mobiscroll.com/vue/eventcalendar/event-popover.md)

## Description

Besides displaying events as labels, you can have them show up in a pop-over. Set it up through the `calendar: {popover: true}` object inside the [`view`](https://mobiscroll.com/docs/javascript/eventcalendar/api#opt-view) option. Using the popover setting saves vertical space and provides a subtle cue to the user that there are events. A small dot will appear in day cells with events or if `calendar: {count: true}` is set, an event count is displayed.

The same popover is rendered when events are displayed as labels and not all fit vertically in the calendar day cells.

**Interested in customizing how the events look?** [Take a look at how you can do it →](https://demo.mobiscroll.com/javascript/eventcalendar/customize-event-popover)

## What this demo shows

- A full month event calendar that keeps the month grid clean by showing daily summary indicators and opening a popover with the events for the selected day.
- **Day cells** Days that have events display a light blue horizontal summary label with `X event` or `X events` text, where `X` represents the number of events, inside the day cell instead of listing every event directly in the month grid.
- **Popover trigger** Clicking or hovering over the summary label highlights it; clicking the label opens a popover above the day cell while the rest of the calendar remains visible in the background.
- **Event list** The popover lists the events for the selected day, and each event has a small colored vertical marker on the left to help distinguish categories.
- **Hover state** Hovering over a day cell highlights the day number in the top-right corner with a gray background.
- **Selection** Clicking an empty part of a day cell selects the day and highlights the day number in blue.
- **Navigation** Users can move between months with the previous and next arrow buttons, the `Today` button in the header, or by clicking and dragging the calendar left or right.

## Best for

- **Booking systems** Reservation and appointment scenarios where each day may contain multiple entries that are easier to inspect in a popover.
- **Event-heavy calendars** Schedules with many events where showing every label directly in the grid would make the month view hard to scan.

## API used in this demo

- [`theme`](https://mobiscroll.com/docs/javascript/eventcalendar/api#opt-theme) - option
- [`themeVariant`](https://mobiscroll.com/docs/javascript/eventcalendar/api#opt-themeVariant) - option
- [`clickToCreate`](https://mobiscroll.com/docs/javascript/eventcalendar/api#opt-clickToCreate) - option
- [`dragToCreate`](https://mobiscroll.com/docs/javascript/eventcalendar/api#opt-dragToCreate) - option
- [`dragToMove`](https://mobiscroll.com/docs/javascript/eventcalendar/api#opt-dragToMove) - option
- [`dragToResize`](https://mobiscroll.com/docs/javascript/eventcalendar/api#opt-dragToResize) - option
- [`eventDelete`](https://mobiscroll.com/docs/javascript/eventcalendar/api#opt-eventDelete) - option
- [`view`](https://mobiscroll.com/docs/javascript/eventcalendar/api#opt-view) - option
- [`onEventClick`](https://mobiscroll.com/docs/javascript/eventcalendar/api#event-onEventClick) - event
- [`setEvents`](https://mobiscroll.com/docs/javascript/eventcalendar/api#method-setEvents) - method

## Code

### JS

```js
var inst = mobiscroll.eventcalendar('#demo-event-popover', {
  theme: 'ios',
  themeVariant: 'light',
  clickToCreate: true,
  dragToCreate: true,
  dragToMove: true,
  dragToResize: true,
  eventDelete: true,
  view: {
    calendar: {
      popover: true,
      count: true,
    },
  },
  onEventClick: function (args) {
    mobiscroll.toast({
      message: args.event.title,
    });
  },
});

mobiscroll.getJson(
  'https://trial.mobiscroll.com/events/?vers=5',
  function (events) {
    inst.setEvents(events);
  },
  'jsonp',
);
```

### HTML

```html
<div id="demo-event-popover"></div>
```

## Implementation notes

- Set `view: { calendar: { popover: true, count: true } }` to show a count indicator in each day cell that has events, and open a popover listing all events for that day when the indicator is clicked.
- Load events from a remote endpoint using `getJson` and assign them to `data`; for the imperative API, call `inst.setEvents(events)` in the callback.
- Handle `onEventClick` to show a `Toast` with `args.event.title`.

## Run it in your project

1. If not signed up yet, or don't own a license, you can [start a free trial](https://mobiscroll.com/starttrial).

2. Clone the repository:

   ```
   git clone https://github.com/acidb/mobiscroll-demos-javascript.git
   ```

3. If not installed yet, install the Mobiscroll CLI from NPM:

   ```
   npm install -g @mobiscroll/cli
   ```

4. Config Mobiscroll - open a terminal window in the root directory and run:

   ```
   mobiscroll config javascript
   ```

5. Install dependencies - open a terminal window in the root directory and run:

   ```
   npm install
   ```

6. Run the project:

   ```
   npm run dev
   ```

On a trial, add `--trial` to the config command: `mobiscroll config javascript --trial`.

Running a demo locally requires a Mobiscroll trial or a license; setup is per framework at https://mobiscroll.com/docs/javascript/getting-started/installation

## Related demos

- Previous: [Event Labels](https://demo.mobiscroll.com/javascript/eventcalendar/event-labels.md) - Show colour-coded event labels inside each day cell of a Javascript month view event calendar — events that don't fit open in a popover.
- Next: [Custom Event Sort Order](https://demo.mobiscroll.com/javascript/eventcalendar/custom-event-sort.md) - Control event display order in a Javascript event calendar — assign per-event priority values or supply a custom function to override the default ordering.
