Inline-style days cells
You can apply a custom inline style to day cells using modifiers. The following example add a custom birthday
modifier for a specific day and a monday
modifiers to match all the Mondays.
Day cells can also formatted using CSS classes.
Code
import React from 'react';
import DayPicker from 'react-day-picker';
import 'react-day-picker/lib/style.css';
export default function Example() {
const modifiers = {
thursdays: { daysOfWeek: [4] },
birthday: new Date(2018, 9, 30),
};
const modifiersStyles = {
birthday: {
color: 'white',
backgroundColor: '#ffc107',
},
thursdays: {
color: '#ffc107',
backgroundColor: '#fffdee',
},
outside: {
backgroundColor: 'white',
},
};
return (
<DayPicker
month={new Date(2018, 9)}
modifiers={modifiers}
modifiersStyles={modifiersStyles}
/>
);
}
Result
October 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
31