---
title: "React Event calendar External Date Picker Navigation Example | Mobiscroll"
component: "Event calendar"
framework: "React"
library_version: "6.2.0"
url: "https://demo.mobiscroll.com/react/eventcalendar/navigate-from-external-date-picker"
---

# External Date Picker Navigation - React Event calendar demo

Use a React event calendar with an external date picker in two-pane layout — date selection navigates the calendar and keeps both in sync. For React and Next.js.

- [Live demo](https://demo.mobiscroll.com/react/eventcalendar/navigate-from-external-date-picker)
- [View React JS code on GitHub](https://github.com/acidb/mobiscroll-demos-react/tree/main/src/demos/eventcalendar/calendar-view/navigate-from-external-date-picker)
- [View React TS code on GitHub](https://github.com/acidb/mobiscroll-demos-react-ts/tree/main/src/demos/eventcalendar/calendar-view/navigate-from-external-date-picker)
- This demo in other frameworks: [JavaScript](https://demo.mobiscroll.com/eventcalendar/navigate-from-external-date-picker.md), [jQuery](https://demo.mobiscroll.com/jquery/eventcalendar/navigate-from-external-date-picker.md), [Angular](https://demo.mobiscroll.com/angular/eventcalendar/navigate-from-external-date-picker.md), [Vue](https://demo.mobiscroll.com/vue/eventcalendar/navigate-from-external-date-picker.md)

## Description

This example demonstrates how can the Eventcalendar navigated externally. Here we have a two-pane layout with a Datepicker on the left and a Calendar on the right. Changing date on the Datepicker will trigger the date change on the Calendar.

The Datepicker updates the [`selectedDate`](https://mobiscroll.com/docs/react/eventcalendar/api#opt-selectedDate) option of the Calendar in its [`onChange`](https://mobiscroll.com/docs/react/datepicker/api#event-onChange) event, while the Calendar updates the datepicker value from its [`onSelectedDateChange`](https://mobiscroll.com/docs/react/eventcalendar/api#event-onSelectedDateChange) event.

## What this demo shows

- This demo shows external navigation between a date picker and a month view event calendar in a two-pane desktop layout.
- **Layout** The date picker is displayed in a separate pane on the left, while the event calendar month view fills the right side.
- **External navigation** Selecting a date in the date picker updates the visible date on the event calendar.
- **Event labels** Days with events display labels directly inside the month cells. Labels use different styles and colors to distinguish all-day events, multi-day, and timed events.
- **Overflow handling** The number of visible event labels depends on the available vertical space in the day cell. Additional events are moved into a popover and indicated by an `X more` label, where `X` represents the number of hidden events. Clicking it opens a popover that lists the remaining events for that day.
- **Label interaction** Hovering over or clicking an event label selects it and highlights the selected label.
- **Day cell states** Hovering a day cell highlights the day number with a gray background, while clicking the empty part of the cell selects the day and highlights the day number with a blue background.
- **Month navigation** The month can be changed by clicking and dragging the calendar left or right.
- **Calendar header** The top-left side shows the current month and year, while the top-right side includes blue previous and next navigation arrows with a `Today` button between them.
- **Date picker header** The date picker header shows the current month and year with previous and next navigation arrows.

## Best for

- **External calendar controls** Apps where users need to navigate the event calendar from a secondary navigation surface.
- **Desktop scheduling layouts** Interfaces that use a two-pane layout to keep date navigation and event overview visible at the same time.
- **Selection-driven workflows** Scheduling and planning experiences where users need clear hover, selection, and active-event states while browsing the calendar.
- **Custom navigation patterns** Products that need to keep multiple calendar-related components in sync when the visible date changes.

## API used in this demo

- [`theme`](https://mobiscroll.com/docs/react/eventcalendar/api#opt-theme) - option
- [`themeVariant`](https://mobiscroll.com/docs/react/eventcalendar/api#opt-themeVariant) - option
- [`display`](https://mobiscroll.com/docs/react/datepicker/api#opt-display) - option
- [`onChange`](https://mobiscroll.com/docs/react/datepicker/api#event-onChange) - event
- [`data`](https://mobiscroll.com/docs/react/eventcalendar/api#opt-data) - option
- [`selectedDate`](https://mobiscroll.com/docs/react/eventcalendar/api#opt-selectedDate) - option
- [`onSelectedDateChange`](https://mobiscroll.com/docs/react/eventcalendar/api#event-onSelectedDateChange) - event

## Code

### JSX

```jsx
import { Datepicker, Eventcalendar, getJson, setOptions } from '@mobiscroll/react';
import { useCallback, useEffect, useState } from 'react';

setOptions({
  theme: 'ios',
  themeVariant: 'light'
});

function App() {
  const [myEvents, setEvents] = useState([]);
  const [mySelectedDate, setSelectedDate] = useState(new Date());

  const handleDateChange = useCallback((args) => {
    setSelectedDate(args.value);
  }, []);

  const handleSelectedDateChange = useCallback((args) => {
    setSelectedDate(args.date);
  }, []);

  useEffect(() => {
    getJson(
      'https://trial.mobiscroll.com/events/?vers=5',
      (events) => {
        setEvents(events);
      },
      'jsonp',
    );
  }, []);

  return (
    <div className="mds-external-nav-calendar mbsc-flex">
      <div className="mds-external-nav-dp">
        <Datepicker value={mySelectedDate} display="inline" onChange={handleDateChange} />
      </div>
      <div className="mds-external-nav-ec mbsc-flex-1-1">
        <Eventcalendar data={myEvents} selectedDate={mySelectedDate} onSelectedDateChange={handleSelectedDateChange} />
      </div>
    </div>
  );
}

export default App;
```

### TSX

```tsx
import {
  Datepicker,
  // Button,
  Eventcalendar,
  getJson,
  MbscCalendarEvent,
  MbscDatepickerChangeEvent,
  MbscDateType,
  MbscSelectedDateChangeEvent,
  setOptions,
} from '@mobiscroll/react';

import { useCallback, useEffect, useState } from 'react';

setOptions({
  theme: 'ios',
  themeVariant: 'light'
});

function App() {
  const [myEvents, setEvents] = useState<MbscCalendarEvent[]>([]);
  const [mySelectedDate, setSelectedDate] = useState<MbscDateType>();

  const handleDateChange = useCallback((args: MbscDatepickerChangeEvent) => {
    if (args.value) {
      setSelectedDate(args.value);
    }
  }, []);

  const handleSelectedDateChange = useCallback((args: MbscSelectedDateChangeEvent) => {
    setSelectedDate(args.date);
  }, []);

  useEffect(() => {
    getJson(
      'https://trial.mobiscroll.com/events/?vers=5',
      (events: MbscCalendarEvent[]) => {
        setEvents(events);
      },
      'jsonp',
    );
  }, []);

  return (
    <div className="mds-external-nav-calendar mbsc-flex">
      <div className="mds-external-nav-dp">
        <Datepicker value={mySelectedDate} display="inline" onChange={handleDateChange} />
      </div>
      <div className="mds-external-nav-ec mbsc-flex-1-1">
        <Eventcalendar data={myEvents} selectedDate={mySelectedDate} onSelectedDateChange={handleSelectedDateChange} />
      </div>
    </div>
  );
}

export default App;
```

### CSS

```css
.mds-external-nav-calendar {
  height: 100%;
}

.mds-external-nav-dp .mbsc-datepicker-inline {
  height: auto;
}

.mds-external-nav-ec {
  border-left: 1px solid #ccc;
}

@media screen and (max-width: 700px) {
  .mds-external-nav-calendar {
    display: block;
  }
}
```

## Implementation notes

- Render an inline `Datepicker` (`display="inline"`) in a left pane and an `Eventcalendar` in a right pane side by side.
- Keep both components in sync through a shared `selectedDate` state variable: in `Datepicker` `onChange`, update `selectedDate` from `args.value`; in `Eventcalendar` `onSelectedDateChange` (Vue: `@selected-date-change`), update `selectedDate` from `args.date`. Pass `selectedDate` to both components so navigating either one updates the other.
- Angular: bind both components to the same value using `ngModel` on the `Datepicker` and `[selectedDate]` on the `Eventcalendar` - no explicit event handlers are needed since the shared binding keeps them in sync automatically.
- JS/jQuery: in `Datepicker` `onChange`, call `calendarInst.navigate(args.value)` to move the calendar; in `Eventcalendar` `onSelectedDateChange`, call `datepickerInst.setVal(args.date)` to update the datepicker.
- Load events from a remote endpoint using `getJson` and assign them to `data`; for the imperative API, call `inst.setEvents(events)` in the callback.

## 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-react.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 react
   ```

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 react --trial`.

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

## Related demos

- Previous: [Switch Day, Week and Month Views](https://demo.mobiscroll.com/react/eventcalendar/switching-day-week-month-view.md) - Switch a React event calendar between day, week, and month views using a header segmented control — each view paired with a matching agenda list.
