Modify the background color of fc-today

Searching for a current solution to this issue has been challenging. Today, I am attempting to modify the highlighted background in my project. My code includes the <FullCalendar> component nested inside <Box>:

<Box flex={"1 1 100%"} ml={"15px"}>
    <FullCalendar
        height={"75vh"}
        plugins={[
            dayGridPlugin,
            timeGridPlugin,
            interactionPlugin,
            listPlugin
        ]}
        headerToolbar={{
            left: "prev,next today",
            center: "title",
            right: "dayGridMonth,timeGridWeek,timeGridDay,listMonth"
        }}
        initialView={"dayGridMonth"}
        editable={true}
        selectable={true}
        selectMirror={true}
        dayMaxEvents={true}
        select={handleDateClick}
        eventClick={handleEventClick}
        eventsSet={(events) => setCurrentEvents(events)}
        initialEvents={[
            {
                id: "aapl_q1_2023",
                title: "AAPL Q1 2023",
                date: "2023-02-02"
            },
            {
                id: "amzn_q4_2023",
                title: "AMZN Q4 2023",
                date: "2023-02-02"
            },
        ]}
        sx={{
            "& .fc-today": {
                backgroundColor: `${colors.redAccent[500]} !important`
            }
        }}
    />
</Box>

When it comes to changing the color manually, I can accomplish that by adjusting the specific css line item.

However, utilizing the sx property doesn't seem to be overriding it as expected:

sx={{
    "& .fc-today": {
        backgroundColor: `${colors.redAccent[500]} !important`
    }
}}

Answer №1

It appears that the FullCalendar library allows for customization of the background color of "today" using a CSS variable called --fc-today-bg-color, as outlined in their customization documentation.

If you prefer to use a custom color defined with Material-UI, you could try setting the CSS variable using the sx prop on the Material-UI Box component that contains the FullCalendar.

For a compact demonstration, check out this live example: stackblitz

Example:

<Box sx={{ ["--fc-today-bg-color"]: pink[500] }}>
  <FullCalendar />
</Box>

You could also try setting this using the sx prop directly on the FullCalendar component itself if it has already been integrated with Material-UI using its styled() utility.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to remove linear-gradient effects applied by a dark mode theme?

Why does MUI add random gradients to components, like in dark mode? Is there a way to disable this feature because it doesn't match the exact color I expected for my custom theme... My Theme Options export const themeOptions: ThemeOptions = { palette ...

What is the best way to compare two arrays of objects and then append a new key to the objects in the second array?

Consider the following arrays where you are tasked with comparing them and returning a filtered version of array two containing elements found in array one: const array1 = [ { name: "Jack", age: 54, title: "IT Engineer" }, { na ...

Guide on displaying React Native code within a React app on a web browser

Instead of creating media queries in my website built with React.JS or Next.JS and an app in React Native, can I display the entire app UI and functionality on mobile and tablet viewports? Please note that my inquiry is not related to code sharing. My ex ...

Close a Material UI Tooltip by Pressing the Escape key

Currently, I am enhancing the accessibility features in an application and one of the WCAG requirements specifies that tooltips should be dismissable with the esc key. However, this functionality is not available natively in the Material UI <Tooltip> ...

Could there be an issue with my website's bootstrap where badges are not being applied properly?

Currently, I am in the process of learning ReactJS and running into an issue where my bootstrap is not working within my .jsx file. Despite following a tutorial (MOSH) diligently and extensively researching on stack overflow, I have not been able to find a ...

What is the process of indicating an item as done using Redux?

Exploring the Redux todo example sandbox has been a fun learning experience for me. Instead of using the default input field and "Add todo" button, I decided to customize the todo list with my own car data. Below is the code snippet from /components/TodoLi ...

What is the most concise way to align one table row in the middle and another at the top?

Is there a way to align different rows in a table vertically with minimal code? I have a table with 3 rows, and I want the first two rows to be aligned vertically to the top, while the third row should be vertically aligned to the middle. If I try to def ...

The updated Capybara now supports the CSS 'contains' selector

Before, my specifications had these lines: within "h3:contains('FooBar text') + dl" do page.should have_content 'FizzBuzz' end (within the definition list following a header that contains specific text) I recently updated capybara- ...

Sending a function along with event and additional arguments to a child component as a prop

I've managed to set up a navigation bar, but now I need to add more complexity to it. Specifically, I have certain links that should only be accessible to users with specific permissions. If a user without the necessary permissions tries to access the ...

It is not possible to adjust the font size of <h1> element within a component in React

class App extends Component { constructor() { super() this.state = { //state is what decribes our app robot: robot, searchfield: '' } } onSearchChange = (event) => { thi ...

Adjust the appearance depending on the React state variable

I am trying to add animation to a search icon when clicked in React. Using the useRef hook, I am able to access the element and applying custom styles to it. const [searchBar, setSearchBar ] = useState(false); const searchIcon = useRef(); const searchIconS ...

What is the process for obtaining coordinates and adding a marker based on the city name in a React Native app

Can you retrieve coordinates and place a marker on a city just by its name? I am attempting to get the coordinates of my search value (which is the city). Below is the code I am using with React Native Maps: import React, {useState} from 'react' ...

Encountering an issue in Typescript where utilizing ref in ShaderMaterial triggers an error stating: "The anticipated type is originating from the property 'ref' declared within the 'PolygonMat' type definition."

While working on a shaderMaterial with the drei library, I encountered an issue with TypeScript when using ref: Type 'RefObject<PolygonMat>' is not assignable to type 'Ref<ShaderMaterial> | undefined'. I defined the type ...

Failed attempt to create a React project using TypeScript

Encountering a problem while using create-react-app with the typescript template, even though it worked previously. However, when attempting to use create-react-app without a template like JSX, everything sets up smoothly. The cause of this issue eludes me ...

I've encountered an issue where my React website functions correctly on the development server but not on the live website. Where should I start investigating to find the cause of this discrepancy?

I am trying to embed a Datawrapper map using the following code: import InnerHTML from 'dangerously-set-html-content' export function Map1(){ const htmlFile = `<div style="min-height: 374px"> <script type="text ...

What is the best way to position the hamburger menu icon on the right side of the header?

I need some assistance with adjusting the position of my mobile hamburger menu icon. It's currently on the left side of the screen, but I want to move it to the right. I've tried making the changes myself using CSS and HTML, but I'm not an e ...

I'm looking to integrate Jest in my React project with npm. How can I achieve

I've developed my application with create react app and npm. While reviewing the official documentation for jest at https://jestjs.io/docs/tutorial-react, I noticed that they only provide information on testing CRA apps using yarn. Does this suggest t ...

Customizing Semantic UI Navigation Menu Styles

For the first time, I am incorporating semantic-ui into my React application. The specific package I am working with can be found here: To display my header, I am using the following code: <Menu className='header' > <Containe ...

The function signature '() => Element' is incompatible with the type 'string'

Greetings! I have a standard function that returns a span with a prop (if I'm not mistaken). In my TS code, I am encountering this error: Error image Below is the code from the file named qCard.tsx: import { QuestionAnswerTwoTone } from "@material- ...

Limiting Material UI Tags - Is there a way to pull all information from the database by simply clicking on the initial tag that says "select all"?

Looking to create an MUI - limit tag. Essentially, I want the user to be able to click on the "select all" element and have all the rest of the data added to small chips at once. If you want to see a demo of what I'm trying to achieve, check out this ...