We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

[DateRangePickerComponent] cssClass property not working in Next.js?

Hello,

I am having problems with DateRangePickerComponent. I am able to override styles through the property cssClass with create-react-app environment, but not with Next.js environment. So maybe is not compatible this feature with Next.js, or does it have nothing to do with this?

Regards,
Néstor Llamas Llopis


3 Replies

DL Deepa Loganathan Syncfusion Team March 27, 2019 12:50 PM UTC

 
Hi Néstor, 
 
We have tested our component with NextJS to override the styles of Daterangepicker cssClass and was able to override the styles as expected. So please ensure if there is any spell error in the cssClass name used in your sample. 
 
For your reference, we have attached the test sample in the below link. 
 
 
Here, we have customized the color of the week end dates in DateRangePicker popup as given in the below code.  
 
[INDEX.JS] 
 
 
import { render } from 'react-dom'; 
import * as React from 'react'; 
import { DateRangePickerComponent } from '@syncfusion/ej2-react-calendars'; 
 
export class Default extends React.Component { 
    render() { 
        return ( 
        <div className='control-pane'> 
                <div className='control-section'> 
                    <div className='daterangepicker-control-section'> 
                    <DateRangePickerComponent cssClass='customCSS' width="500px"></DateRangePickerComponent> 
                    </div> 
                </div>  
                 <link rel='nofollow' href="https://cdn.syncfusion.com/ej2/material.css" rel="stylesheet" /> 
                 <style jsx global>{` 
                 .customCSS .e-calendar .e-content .e-weekend span {  
                 color: red; 
                 } 
                 `}</style> 
            </div> 
             
            ); 
    } 
} 
 
export default Default; 
 
 
 
Note: Please download the sample from the above link and run “npm install” command to install the required packages and run “npm run dev” command to launch the application in browser. 
 
To know more about cssClass, please refer the below documentation link. 
 
 
If you are still facing issues in customizing Daterangepicker, please revert with issue reproducing sample that will help us to check and isolate the root cause of the issue and provide a prompt solution soon. 
 
Regards, 
Deepa L. 
 



NL Néstor Llamas Llopis March 27, 2019 03:43 PM UTC

OK, I've seen my error. I was declaring <style jsx> instead of <style jsx global>, so the styles couldn't be passed to DateRangePickerComponent as the scope was local, not global.


DL Deepa Loganathan Syncfusion Team March 28, 2019 04:37 AM UTC

Hi Néstor,  

We are glad to hear that the issue was resolved. Please let us know if you would require any further assistance.  

Regards,  
Deepa L. 


Loader.
Live Chat Icon For mobile
Up arrow icon