React-calendar: Custom styling

Created on 7 Sep 2018  路  14Comments  路  Source: wojtekmaj/react-calendar

Hello there,
How do I get rid of some of those elements such as the << >> arrows, change Mon Tue Wed to just M T W.

Thanks in advance!

Most helpful comment

@bobgutierrez
font family: Just via CSS font-family, should work fine.
circles: border-radius: 50% on .react-calendar__tile--active class

@yerassylad
flex-wrap: nowrap; to .react-calendar__month-view__days and margin: 0 !important; to .react-calendar__month-view__days .react-calendar__tile

All 14 comments

check out the prevLabel and the prev2Label in the docs! The PrevLabel prop is what renders the '<' arrows, and the prev2Label is what renders '<<'

thanks for your reply, I got that figured out. But not sure how to Chang Mon Tue We鈥檇 to just M T W T

You can hide that using CSS :) You need display: none on .react-calendar__month-view__weekNumbers.

Hi,
How can I change font family? Also, I want circles instead of squares when selecting a day, is that possible? Can I have today鈥檚 day showing with one style and another day selected i.e. 2 days ago, with a different style?

Hello, what can i do to change rendering of days to one line?
like:
1 2 3 4 ... 30

@bobgutierrez
font family: Just via CSS font-family, should work fine.
circles: border-radius: 50% on .react-calendar__tile--active class

@yerassylad
flex-wrap: nowrap; to .react-calendar__month-view__days and margin: 0 !important; to .react-calendar__month-view__days .react-calendar__tile

Hello @wojtekmaj, can we pass styles using the style prop?

can add any html tag on Date box?

@Clepto no, it's not possible, sorry.

@saitodisse You can't, but you can use CSS content to prepend/append content with some additional text.

@bobgutierrez
circles: border-radius: 50% on .react-calendar__tile--active class

This does not work, since they are not circles, but ellipsises - element is 36x29
image

Looking at code, I think for my case it's just hardcoded as count={7} for days, so applying some custom height of height: 36px; should work for me

@llamerr i found out you can do this to override the circle element style :)

"& abbr": {
              textDecoration: "none",
              width: "24px",
              height: "24px",
              borderRadius: "50%",
              display: "flex",
              justifyContent: "center",
              alignItems: "center"
            },

how to change the border color of react-calendar?

.react-calendar{
    border: none !important;
}

I wrote this code .. but it doesn't work

Hi, how could I change weekdays to - "M", "T", "W" ... instead of "MON" "TUE" "WED" ... ? And round only left and right for the first and last selected date on selecting range?

@raraitis

Hi, how could I change weekdays to - "M", "T", "W" ... instead of "MON" "TUE" "WED" ... ?

See README for formatShortWeekday.

And round only left and right for the first and last selected date on selecting range?

Tiles have classes:

  • .react-calendar__tile--range
  • .react-calendar__tile--rangeStart
  • .react-calendar__tile--rangeEnd

I think they are pretty self explanatory. Add styles as you need them.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rmccue picture rmccue  路  4Comments

wojtekmaj picture wojtekmaj  路  3Comments

Muttakee31 picture Muttakee31  路  4Comments

boonware picture boonware  路  4Comments

guydewinton picture guydewinton  路  3Comments