CSS Classes for Cell Colors and Blocked Times

Besides customizing the background color of cells and setting up invalid/blocked out times you can customize how these blocks and disabled times look by passing a cssClass to the colors and invalid array elements.

The output could be a custom pattern, custom styling for the labels or anything that you'd like to render as the background. This a great way for adding special meaning to certain days and time ranges.

Get started with this example

Demo

Loading the live demo

Preview in full screen

Apply custom CSS classes to color-code Scheduler cells and style blocked times - add patterns or backgrounds for days or periods.

Code

import { CommonModule } from '@angular/common';
import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { MbscCalendarEvent, MbscEventcalendarOptions, MbscModule, setOptions  } from '@mobiscroll/angular';

setOptions({
  locale:  ,
  theme: ' ',
  themeVariant: ' '
});

@Component({
  selector: 'app-root', 
  templateUrl: './app.component.html',
  standalone: true,
  imports: [CommonModule, MbscModule],
})
export class AppComponent implements OnInit {
  constructor(private http: HttpClient) {}

  myEvents: MbscCalendarEvent[] = [];

  calendarSettings: MbscEventcalendarOptions = {
    clickToCreate:  ,
    dragToCreate:  ,
    dragToMove:  ,
    dragToResize:  ,
    eventDelete:  ,
    view: {
      scheduler: {
        allDay: false,
        type: 'week',
        startDay: 1,
        endDay: 5,
      },
    },
    invalid: [
      {
        start: '12:00',
        end: '13:00',
        title: 'Lunch break',
        recurring: {
          repeat: 'weekly',
          weekDays: 'MO,TU,WE,TH,FR',
        },
        cssClass: 'md-lunch-break-class mbsc-flex',
      },
    ],
    colors: [
      {
        start: '03:00',
        end: '10:00',
        recurring: {
          repeat: 'weekly',
          weekDays: 'MO',
        },
        cssClass: 'md-rect-bg',
      },
      {
        start: '16:00',
        end: '22:00',
        recurring: {
          repeat: 'weekly',
          weekDays: 'TH',
        },
        cssClass: 'md-rect-bg',
      },
      {
        start: '15:00',
        end: '21:00',
        recurring: {
          repeat: 'weekly',
          weekDays: 'MO',
        },
        cssClass: 'md-stripes-bg',
      },
      {
        start: '04:00',
        end: '10:00',
        recurring: {
          repeat: 'weekly',
          weekDays: 'FR',
        },
        cssClass: 'md-stripes-bg',
      },
      {
        start: '02:00',
        end: '09:00',
        recurring: {
          repeat: 'weekly',
          weekDays: 'TU',
        },
        cssClass: 'md-dots-bg',
      },
      {
        start: '14:00',
        end: '20:00',
        recurring: {
          repeat: 'weekly',
          weekDays: 'WE',
        },
        cssClass: 'md-dots-bg',
      },
    ],
  };

  ngOnInit(): void {
    this.http.jsonp<MbscCalendarEvent[]>('https://trial.mobiscroll.com/workday-events/', 'callback').subscribe((resp) => {
      this.myEvents = resp;
    });
  }
}

Duplicate Session

You have signed in on a different machine. To keep everything in sync, you have been signed out of this session.

If you need to invite team members, manage seats and accounts you can do it from the licenses page.

Duplicate Session

We noticed you are logged in on a different machine and have closed your old session.

If you need to invite team members, manage seats and accounts you can do it from the licenses page.