FullCalendar css dosent work with nextjs
Unanswered
American Chinchilla posted this in #help-forum
Original message was deleted.
40 Replies
American Chinchilla
'use client'
import React, { useState, useRef, useEffect } from 'react';
import FullCalendar from "@fullcalendar/react";
import dayGridPlugin from "@fullcalendar/daygrid";
import timeGridPlugin from "@fullcalendar/timegrid";
import interactionPlugin from "@fullcalendar/interaction";
export const CalendarView = () => {
const [currentDate, setCurrentDate] = useState(new Date());
const { locale } = useTimelineStore(); // 'en-US' by default
const calendarRef = useRef(null);
return (
<div className="w-full p-4 relative">
{/* FullCalendar Component */}
<div className='w-full'>
<FullCalendar
ref={calendarRef}
plugins={[dayGridPlugin, timeGridPlugin, interactionPlugin]}
initialView="timeGridWeek"
headerToolbar={{
left: '',
center: 'title',
right: 'dayGridMonth,timeGridWeek'
}}
locale={locale}
events={[]}
nowIndicator={true}
height={800}
slotMinTime="00:00:00"
slotMaxTime="24:00:00"
allDaySlot={false}
slotDuration="01:00:00"
selectable={true}
selectMirror={false}
editable={true}
dayHeaders={true}
timeZone="UTC"
firstDay={1}
dayHeaderFormat={{ weekday: 'long', day: 'numeric' }}
/>
</div>
</div>
);
};
American Chinchilla
Normally with version 6 there's no more css to add manually, it's done in shadow... didn't catch the name.
I found an official example repos and it is not added any more:
https://github.com/fullcalendar/fullcalendar-examples/blob/main/next13/pages/calendar.js
I found an official example repos and it is not added any more:
https://github.com/fullcalendar/fullcalendar-examples/blob/main/next13/pages/calendar.js
I wonder if it's because the version of nextjs 14 is no longer compatible.
so no css is applied to the rendered html?
u probably checked right
Original message was deleted
i just realized, u also installed @fullcalendar/core right?
American Chinchilla
if i put the css import
@gin i just realized, u also installed @fullcalendar/core right?
American Chinchilla
yes
"@fullcalendar/core": "^6.1.15",
"@fullcalendar/daygrid": "^6.1.10",
"@fullcalendar/interaction": "^6.1.10",
"@fullcalendar/react": "^6.1.10",
"@fullcalendar/timegrid": "^6.1.10",@gin so no css is applied to the rendered html?
American Chinchilla
no css is applied
u did check that the css exists right?
i dont see anything
American Chinchilla
That's why we used to have to add the css manually, but now it has to be integrated into the source tsx file and we don't need to do that any more. That was just an example if I import the css file directly.
I've seen that people with remix have the same problem: https://github.com/fullcalendar/fullcalendar/issues/7261
I've seen that people with remix have the same problem: https://github.com/fullcalendar/fullcalendar/issues/7261
American Chinchilla
In all the examples I've seen in the package.json they don't have the ‘type’: ‘module’,
@American Chinchilla In all the examples I've seen in the package.json they don't have the ‘type’: ‘module’,
i found this for daygrid ->
:root{--fc-daygrid-event-dot-width:8px}.fc-daygrid-day-events:after,.fc-daygrid-day-events:before,.fc-daygrid-day-frame:after,.fc-daygrid-day-frame:before,.fc-daygrid-event-harness:after,.fc-daygrid-event-harness:before{clear:both;content:\"\";display:table}.fc .fc-daygrid-body{position:relative;z-index:1}.fc .fc-daygrid-day.fc-day-today{background-color:var(--fc-today-bg-color)}.fc .fc-daygrid-day-frame{min-height:100%;position:relative}.fc .fc-daygrid-day-top{display:flex;flex-direction:row-reverse}.fc .fc-day-other .fc-daygrid-day-top{opacity:.3}.fc .fc-daygrid-day-number{padding:4px;position:relative;z-index:4}.fc .fc-daygrid-month-start{font-size:1.1em;font-weight:700}.fc .fc-daygrid-day-events{margin-top:1px}.fc .fc-daygrid-body-balanced .fc-daygrid-day-events{left:0;position:absolute;right:0}.fc .fc-daygrid-body-unbalanced .fc-daygrid-day-events{min-height:2em;position:relative}.fc .fc-daygrid-body-natural .fc-daygrid-day-events{margin-bottom:1em}.fc .fc-daygrid-event-harness{position:relative}.fc .fc-daygrid-event-harness-abs{left:0;position:absolute;right:0;top:0}.fc .fc-daygrid-bg-harness{bottom:0;position:absolute;top:0}.fc .fc-daygrid-day-bg .fc-non-business{z-index:1}.fc .fc-daygrid-day-bg .fc-bg-event{z-index:2}.fc .fc-daygrid-day-bg .fc-highlight{z-index:3}.fc .fc-daygrid-event{margin-top:1px;z-index:6}.fc .fc-daygrid-event.fc-event-mirror{z-index:7}.fc .fc-daygrid-day-bottom{font-size:.85em;margin:0 2px}.fc .fc-daygrid-day-bottom:after,.fc .fc-daygrid-day-bottom:before{clear:both;content:\"\";display:table}.fc .fc-daygrid-more-link{border-radius:3px;cursor:pointer;line-height:1;margin-top:1px;max-width:100%;overflow:hidden;padding:2px;position:relative;white-space:nowrap;z-index:4}.fc .fc-daygrid-more-link:hover{background-color:rgba(0,0,0,.1)}.fc .fc-daygrid-week-number{background-color:var(--fc-neutral-bg-color);color:var(--fc-neutral-text-color);min-width:1.5em;padding:2px;position:absolute;text-align:center;top:0;z-index:5}.fc .fc-more-popover .fc-popover-body{min-width:220px;padding:10px}.fc-direction-ltr .fc-daygrid-event.fc-event-start,.fc-direction-rtl .fc-daygrid-event.fc-event-end{margin-left:2px}.fc-direction-ltr .fc-daygrid-event.fc-event-end,.fc-direction-rtl .fc-daygrid-event.fc-event-start{margin-right:2px}.fc-direction-ltr .fc-daygrid-more-link{float:left}.fc-direction-ltr .fc-daygrid-week-number{border-radius:0 0 3px 0;left:0}.fc-direction-rtl .fc-daygrid-more-link{float:right}.fc-direction-rtl .fc-daygrid-week-number{border-radius:0 0 0 3px;right:0}.fc-liquid-hack .fc-daygrid-day-frame{position:static}.fc-daygrid-event{border-radius:3px;font-size:var(--fc-small-font-size);position:relative;white-space:nowrap}.fc-daygrid-block-event .fc-event-time{font-weight:700}.fc-daygrid-block-event .fc-event-time,.fc-daygrid-block-event .fc-event-title{padding:1px}.fc-daygrid-dot-event{align-items:center;display:flex;padding:2px 0}.fc-daygrid-dot-event .fc-event-title{flex-grow:1;flex-shrink:1;font-weight:700;min-width:0;overflow:hidden}.fc-daygrid-dot-event.fc-event-mirror,.fc-daygrid-dot-event:hover{background:rgba(0,0,0,.1)}.fc-daygrid-dot-event.fc-event-selected:before{bottom:-10px;top:-10px}.fc-daygrid-event-dot{border:calc(var(--fc-daygrid-event-dot-width)/2) solid var(--fc-event-border-color);border-radius:calc(var(--fc-daygrid-event-dot-width)/2);box-sizing:content-box;height:0;margin:0 4px;width:0}.fc-direction-ltr .fc-daygrid-event .fc-event-time{margin-right:3px}.fc-direction-rtl .fc-daygrid-event .fc-event-time{margin-left:3px}what happens if u create a css and import that into your component
its really weird how they do that
American Chinchilla
No, a priori it has no influence. I created the css file and imported it into my component, but nothing happened.
I'm going to make an issue on their github I think
I'm going to make an issue on their github I think
American Chinchilla
Yes, have you tried lib at home by any chance? Just to make sure it's not coming from my setup or something.
If anyone falls down here and wants to see the way out, it's next: https://github.com/fullcalendar/fullcalendar/issues/7793
@American Chinchilla Yes, have you tried lib at home by any chance? Just to make sure it's not coming from my setup or something.
can u share a minimal codebase or something?
American Chinchilla
npm install --save \
@fullcalendar/core \
@fullcalendar/react \
@fullcalendar/daygridimport FullCalendar from '@fullcalendar/react'
import dayGridPlugin from '@fullcalendar/daygrid' // a plugin!
export default function Calendar() {
return (
<FullCalendar
plugins={[ dayGridPlugin ]}
initialView="dayGridMonth"
/>
)
}and on the base page.jsx make <Calendar />
alr one sec
American Chinchilla
and if you have npm install --save @fullcalendar/timegrid
et set plugins={[dayGridPlugin, timeGridPlugin, interactionPlugin]}
initialView="timeGridWeek"
et set plugins={[dayGridPlugin, timeGridPlugin, interactionPlugin]}
initialView="timeGridWeek"
American Chinchilla
it should go something like this
i mean looks good for me?
just the data is missing
American Chinchilla
huuum interesting