twitter-bootstrapfullcalendarbootstrap-5fullcalendar-6

Premium Fullcalendar not picking up Bootstrap5 theme


here is premium fullcalendar with bootstrap5 theme added but not working

This is what i'm seeing (theme does not look to be applied)

This is how i would expect it to look

this is what i want it to look like

I can get the bootstrap theme to work on the standard edition of fullcalendar, just not the premium version

I have added this line to the init of the calendar

document.addEventListener('DOMContentLoaded', function() {
  var calendarEl = document.getElementById('calendar');

  var calendar = new FullCalendar.Calendar(calendarEl, {
    themeSystem: 'bootstrap5',
    timeZone: 'UTC',
    editable: true,
    initialView: 'resourceTimelineDay',
    initialDate: '2024-06-05',
    headerToolbar: {
      left: 'prev,next today',
      center: 'title',
      right: 'resourceTimelineDay,resourceTimeGridDay'
    },
    resourceAreaHeaderContent: 'Rooms',
    views: {
      resourceTimelineDay: { buttonText: 'timeline' },
      resourceTimeGridDay: { buttonText: 'timeGrid' }
    },
    events: [
      {
        resourceId: 'a',
        title: 'Timed Event',
        start: '2024-06-05T16:00:00+00:00'
      },
      {
        resourceId: 'b',
        title: 'Conference',
        start: '2024-06-05'
      },
      {
        resourceId: 'c',
        title: 'Meeting',
        start: '2024-06-05T10:30:00+00:00',
        end: '2024-06-05T12:30:00+00:00'
      },
      {
        resourceId: 'a',
        title: 'Lunch',
        start: '2024-06-05T12:00:00+00:00'
      }
    ],
    resources: [
      {
        id: 'a',
        title: 'Auditorium A'
      },
      {
        id: 'b',
        title: 'Auditorium B'
      },
      {
        id: 'c',
        title: 'Auditorium C'
      },
      {
        id: 'd',
        title: 'Auditorium D'
      }
    ]
  });

  calendar.render();
});
html, body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica Neue, Helvetica, sans-serif;
  font-size: 14px;
}

#calendar {
  max-width: 1100px;
  margin: 40px auto;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/fullcalendar-scheduler@6.1.14/index.global.min.js"></script>
<div id='calendar'></div>


Solution

  • The fullCalendar bootstrap 5 theme documentation says:

    In order to correctly theme your calendar with a Bootstrap 5 theme, you must include the correct stylesheets, include the JavaScript plugin, and set themeSystem to 'bootstrap5'.

    Your code has some issues:

    Here's a working version:

    document.addEventListener('DOMContentLoaded', function() {
      var calendarEl = document.getElementById('calendar');
    
      var calendar = new FullCalendar.Calendar(calendarEl, {
        themeSystem: 'bootstrap5',
        timeZone: 'UTC',
        editable: true,
        initialView: 'resourceTimelineDay',
        initialDate: '2024-06-05',
        headerToolbar: {
          left: 'prev,next today',
          center: 'title',
          right: 'resourceTimelineDay,resourceTimeGridDay'
        },
        resourceAreaHeaderContent: 'Rooms',
        views: {
          resourceTimelineDay: { buttonText: 'timeline' },
          resourceTimeGridDay: { buttonText: 'timeGrid' }
        },
        events: [
          {
            resourceId: 'a',
            title: 'Timed Event',
            start: '2024-06-05T16:00:00+00:00'
          },
          {
            resourceId: 'b',
            title: 'Conference',
            start: '2024-06-05'
          },
          {
            resourceId: 'c',
            title: 'Meeting',
            start: '2024-06-05T10:30:00+00:00',
            end: '2024-06-05T12:30:00+00:00'
          },
          {
            resourceId: 'a',
            title: 'Lunch',
            start: '2024-06-05T12:00:00+00:00'
          }
        ],
        resources: [
          {
            id: 'a',
            title: 'Auditorium A'
          },
          {
            id: 'b',
            title: 'Auditorium B'
          },
          {
            id: 'c',
            title: 'Auditorium C'
          },
          {
            id: 'd',
            title: 'Auditorium D'
          }
        ]
      });
    
      calendar.render();
    });
    html, body {
      margin: 0;
      padding: 0;
      font-family: Arial, Helvetica Neue, Helvetica, sans-serif;
      font-size: 14px;
    }
    
    #calendar {
      max-width: 1100px;
      margin: 40px auto;
    }
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css" rel="stylesheet"/>
    <script src="https://cdn.jsdelivr.net/npm/fullcalendar-scheduler@6.1.14/index.global.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/@fullcalendar/bootstrap5@6.1.14/index.global.min.js"></script>
    <div id='calendar'></div>

    N.B. I do think the documentation could make the requirement for the extra plugin clearer. The "Using a bundle" part of the documentation page in particular does not (at the time of writing) show the use of the extra JS file, although the live demo does, if you click through to its CodePen source.