I am using react-datepicker package and i need to add a custom height and width.
I tried with popperClassName prop but its not working correctly. Is there any way to style the height and width of the entire calendar? This is my component.
<DatePicker
selected={startDate}
dateFormat="MM/yyyy/dd"
// showMonthYearPicker
popperPlacement="top-end"
popperClassName={Styles.calendarPopper}
icon={<SmCalenderIcon />}
onChange={(date) => handleDateChange(date)}
// wrapperClassName={Styles.dateWrapper}
// showIcon
className={Styles.datePicker}
// minDate={subDays(startDate, 7)}
maxDate={new Date()}
shouldCloseOnSelect={false}
/>
2
Answers
1- Create a custom CSS file: Define your custom styles for the date picker.
2 – Import the CSS file in your component: Ensure your custom CSS file is imported so the styles are applied.
By following these steps, you should be able to style the react-datepicker component with custom height and width. Ensure that your styles are specific enough to override any default styles provided by the react-datepicker package.
Another way can be by using styled components