Add CSS modifiers to day cells

You can add custom CSS classes to day cells using modifiers. The following example add a custom birthday CSS modifier for a specific day and a monday modifiers to match all the Mondays.

Day cells can also formatted using inline styles.

Code


import React from 'react';
import Helmet from 'react-helmet';
import DayPicker from 'react-day-picker';
import 'react-day-picker/lib/style.css';

const modifiers = {
  disabled: { daysOfWeek: [6] },
  birthday: new Date(2018, 8, 19),
  monday: { daysOfWeek: [1] },
};

export default function Example() {
  return (
    <div>
      <Helmet>
        <style>{`
          .DayPicker-Day--birthday {
            background-color: #00bcd4;
            color: white;
          }
          .DayPicker-Day--monday {
            color: #00bcd4;
          }
          `}</style>
      </Helmet>
      <DayPicker month={new Date(2018, 8)} modifiers={modifiers} />
    </div>
  );
}

Result


September 2018
Su
Mo
Tu
We
Th
Fr
Sa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30