The styles for the React calendar are not being properly applied to the calendar component due to CSS overriding

Having trouble overriding the default Calendar.css file in NextJS while creating a calendar component. Even after adding my own custom styles, they aren't being applied. Deleting the css file contents doesn't change the format either. Only when commenting out the import css line does the style return to normal. Could this be a bug related to React 18/Nextjs? Tested in both chrome and firefox with identical results. https://i.stack.imgur.com/IenRI.jpghttps://i.stack.imgur.com/j4obW.jpg

The first image shows the display after applying the default css styling from the module. The second image displays how I want it to look after overriding the default css file.

    .react-calendar {
  width: 350px;
  max-width: 100%;
  background: white;
  border: 1px solid #a0a096;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.125em;
}
... (CSS code continues)

This is the default css style.

.react-calendar { 
 width: 400px;
 max-width: 100%;
 background-color: #fff;
 color: #222;
 ... (More CSS code)
}

This is the custom styling I am trying to implement. Even if all content from Calendar.css is deleted, the initial styling still persists.

// App.js

import { useState } from "react";
import Calendar from "react-calendar";
import "react-calendar/dist/Calendar.css";

function cal() {
  const [date, setDate] = useState(new Date());

  return (
    <div className="app">
      <h1 className="text-center">React Calendar</h1>
      ... (JSX markup continued)
    </div>
  );
}

export default cal;

This is where the calendar component is being created.

Answer №1

To ensure the overwrite, you can include !important in the properties, like this:

.custom-calendar__tile--endRange {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  border-top-right-radius: 6px !important;
  border-bottom-right-radius: 6px !important;
  background: #6f48eb !important;
  color: white !important;
}

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

Every time I attempt to execute npm run build on my next.js project, I consistently encounter an error

I keep encountering an issue whenever I attempt to execute npm run build for my project. The error message reads: "Cannot read properties of undefined (reading 'email')." My understanding is that it implies the email cannot be undefined, but I am ...

Creating a release of an Angular 12 library using Ivy and sharing it on npm

Recently, I had the task of updating a library to angular 12. After successfully compiling it with Ivy full compilation mode, I realized that it cannot be published on npm in this state. Following suggestions from various sources, I tried setting "enableI ...

Having trouble locating the nivoslider IE8 jQuery bug, can't seem to track it

I am encountering an issue with the nivoslider script in IE8 and I am having trouble identifying what is causing it. The nivoslider works perfectly fine in all other browsers except for IE8. Any help or guidance on this matter would be greatly appreciated ...

Tips for avoiding the automatic conversion of 0.00 to 0.0 by prettier eslint

I am working on ComponentA and need to set the default value to 0.00. However, the formatting by prettier eslint changes it from 0.00 to 0.0 in the component file. How can we prevent this from happening? export const ComponentA = ({ validate, isRequired }) ...

Techniques for preventing background layering using CSS

I have implemented a background image on the <input type="submit"> element to give it the appearance of a button. My CSS code looks like this: input.button { background-image:url(/path/to/image.png); } Furthermore, I would like to display a dif ...

Problem with traversing from parent to children elements using jQuery selectors

<form data-v-c4600f50="" novalidate="novalidate" class="v-form"> <div data-v-c4600f50="" class="pr-2" question="Top Secret4"> <div data-v-c4600f50="" f ...

When attempting to add @chainlink/contracts as a development dependency using yarn, an error occurred stating "Permission denied Public

**Encountering an issue with permissions while running yarn add --dev @chainlink/contracts: "Permissions denied: Public Key" Error: Exit code: 128 Command: git Arguments: ls-remote --tags --heads ssh://<a href="/cdn-cgi/l/email-protection" class="__cf_ ...

Expanding Gridview Width within a Container in ASP.Net: A Step-by-Step Guide

https://i.stack.imgur.com/ZaJE7.jpg After viewing the image above, I am facing a challenge with stretching and fixing a gridview to contain the entire div where it is placed. The issue arises when the gridview adjusts automatically based on the content&ap ...

Is it worth exploring if using useCallback will truly boost performance or be advantageous in any way?

I understand the purpose of useCallback and that it can be useful for maintaining reference equality. However, in my specific case, it would primarily serve as a potential performance optimization. Since this is for a React Native project intended to run o ...

Error encountered while upgrading to Angular 5: splitHash issue

Currently in the process of transitioning from Angular 4.x to 5.x, I have encountered the following error: main.81bcdf404dc22078865d.bundle.js:1 Uncaught TypeError: i.splitHash is not a function at Object.t.parseUrl (main.81bcdf404dc22078865d.bundle.js:1) ...

What is the method to determine the size of a Map object in Firestore database?

I currently have two elements within a document: an empty array, and a map object containing three components. If the array is empty, it transforms into type array. In this case, I can execute console.log(vehicles.Motorcycles.length) to receive a return of ...

What steps can be taken to update the cart if all products have been removed?

How can I implement a refresh for my cart page every time the product length is 0 without causing unreachable code? It seems like there must be a simple solution to this problem. switch (action.type){ case "REMOVE_PRODUCT": return ...

Concluding the dialogue once the post request has been successfully processed

My tech stack includes React, Redux, NodeJS, and ExpressJS. For the front-end, I'm utilizing material-ui. Within my application, I have implemented a dialog that allows users to input information and sign up. Upon clicking submit, a POST request is in ...

Looking to deactivate a particular checkbox in a chosen mode while expanding the tree branches

I encountered an issue with a checkbox tree view where I needed to disable the first two checkboxes in selected mode. While I was able to achieve this using the checked and readonly properties, I found that I could still uncheck the checkboxes, which is no ...

Issue encountered: Unable to locate the file "SignInScreen" within the directory "./src/screens/authScreens" as referenced in the file "App.js"

App.js: import { StyleSheet, Text, View, StatusBar } from "react-native"; import { colors, parameters } from "./src/global/styles"; import SignInScreen from "./src/screens/authScreens/SignInScreen"; export default function A ...

ReactJS Typescript Material UI Modular Dialog Component

Hello, I need help with creating a Reusable Material UI Modal Dialog component. It's supposed to show up whenever I click the button on any component, but for some reason, it's not displaying. Here's the code snippet: *********************TH ...

What is the best method for incorporating a drop-down menu in every row of a Material UI Table?

I am currently facing an issue with implementing the material-ui Drop Down Menu in each row within a material-ui Table. The problem arises when I attempt to change the value of one drop down; it results in every other drop down's value changing as wel ...

Encountering the error message "Module not found: '@next/env'" during Vercel deployment

I've been struggling with this error for a while now... View Screenshot from Vercel I have a .env file in my main directory. Since I am new to web deployment, I wasn't entirely sure about what should go into the .env file. One thing that confused ...

Warning for unmet peer dependency still persisting despite installation of the required peer dependency

Adding redux to my Ionic 3+ application has been a bit of a challenge. Here's the command I used: npm i redux @angular-redux/store flux-standard-action redux-logger --save After running this command, I encountered the following error message: UNMET ...

Tips for changing the style ID depending on the variable value

Currently, I am exploring the possibility of switching CSS styles using jQuery through a simple if condition. Is there an easy method to switch styles based on IDs? In my case, I have two CSS blocks each with different IDs. Here is an example: <style ...