Custom View

Render appointments in an Angular template while the Scheduler handles navigation, data loading and event details.

Two-week handover board

The following example demonstrates a fourteen-day view with separate lists for operating windows and timed reviews. Open an appointment, then choose Next to inspect the following handover period.

UTC

Handover board

3 appointments from 2026-12-21 until 2027-01-04 (exclusive)

Operating windows

Scheduled reviews

Define the period

Implement NgbSchedulerCustomView. Return civil dates from both callbacks. The range includes the selected date and ends at the first excluded date. Use deterministic rules for server rendering.

      function addDays(date: string, days: number): string {
  const value = new Date(date + 'T00:00:00Z');
  value.setUTCDate(value.getUTCDate() + days);
  return value.toISOString().slice(0, 10);
}

// Component fields
readonly views: NgbSchedulerViewConfig[] = [{ type: 'custom', label: 'Handover' }, { type: 'day' }];
readonly fortnight: NgbSchedulerCustomView = {
  range: date => ({ start: date, end: addDays(date, 14) }),
  navigate: (date, direction) => addDays(date, 14 * direction)
};
    

Connect the template

Import the standalone NgbSchedulerCustomViewDirective and Scheduler component. Add one custom entry to views, bind both inputs and use the typed template context to render intersecting appointments. Use native buttons for keyboard activation.

      <ng-template ngbSchedulerCustomView #board="ngbSchedulerCustomView"
  let-events let-range="range" let-activate="activate">
  <section aria-label="Handover board" class="p-3">
    <h3 class="h5">Handover board</h3>
    <p role="status">{{ events.length }} appointments from {{ range.start }} until {{ range.end }} (exclusive)</p>
    <div class="row g-3">
      @for (allDay of [true,false]; track allDay) {
        <section class="col-md-6">
          <h4 class="h6">{{ allDay ? 'Operating windows' : 'Scheduled reviews' }}</h4>
          <ul class="list-group">
            @for (event of events; track event.id) {
              @if (!!event.allDay === allDay) {
                <li class="list-group-item"><button type="button" class="btn btn-link text-start" (click)="activate(event)">{{event.title}}</button></li>
              }
            }
          </ul>
        </section>
      }
    </div>
  </section>
</ng-template>
<ngb-scheduler date="2026-12-21" view="custom" [views]="views"
  [customView]="fortnight" [customViewTemplate]="board.template"
  [events]="events" [showEventPreview]="true" label="Operations handover" />
    

With a datasource, the Scheduler requests the custom range and cancels superseded loads. Loading, retry and event previews use the usual Scheduler controls. The template owns its layout, empty state and keyboard behavior. Built-in slot selection and drag handles belong to the time-grid views.