Search code examples
fullcalendarfullcalendar-5

FullCalendar - Getting both HTML and arg in eventContent


I am trying to create a custom event tile in FullCalendar. I want to show the title on one line and an extendedProps entry on the next one. Now I found 2 ways to achieve either HTML or using args:

eventContent:  (arg) => ( arg.event.title + ' ' + arg.event.extendedProps.places + ' Places')

or

eventContent: { html: 'Title <br> places'}

What I am wondering is if there is a way to use both.


Solution

  • You can inject into the HTML with properties of the event as follows:

    eventContent: function(eventInfo) { return { html: eventInfo.event.title + "<br> " + eventInfo.event.extendedProps.places + " Places" } }