WHAT I WANT IS: MONTHS TO BE FROM LEFT TO RIGHT having JAN FEB MAR in the first ROW.
JAN FEB MAR
APR MAY JUN
Encountering Problem in updating datepicker months in react-datepicker
. Below image
shows 4 months in each row. Also, the months seems to be out of the allocaoted
width 309px
. Trying to fit the months boxes within the allocated space having
3 months in a single row.
Library in used: react-datepicker;
Though fits into the box, however, the alignment of months is not correct.
The requirement is to have
JAN FEB MAR
APR MAY JUN
...
After doing few tweaks, I can get the following. I’d appreciate your help on the requirement i.e., Months to be displayed from left to right having 3 months in one Row.
.react-datepicker__month-wrapper{
display: flex;
flex-direction: column; //-->updated
}
.react-datepicker__month {
// margin: 4rem;
text-align: center;
display: flex;
flex-direction: row; //-->Updated
margin:auto;
padding-top: 10px;
}
[![enter image description here][2]][2]
BROWSERS ELEMENTS
[![enter image description here][3]][3]
4
Answers
Try this:
and for your Css try This:
remove
display:column
from your.react-datepicker__month-wrapper
element and add it to.react-datepicker__month
More info: Link
Do the folowing:
flex-wrap: wrap
onreact-datepicker__month
so that it wraps.flex-direction: column;
fromreact-datepicker__month-wrapper
.showThreeColumnMonthYearPicker
1.
2.
3.
There is a div that wraps every 4 month with a class called
.react-datepicker__month-wrapper
.Visit
CODESANDBOX
The above layout could be easily get by change code like this
Change
showFourColumnMonthYearPicker
toshowThreeColumnMonthYearPicker
Finally Code Should Look Like
Check my example here, I have tried to make it as you described
Basically what I did was to use this css code: