1
1
## react-horizontal-datepicker
2
- A fully style-able horizontal date picker with the option to scroll for web
3
- ![ Example] ( https://i.imgur.com/oe3WEGF.jpg )
2
+ ###### V2 with new logic and completely removing dependancy on react-waypoint as well as leaner code which now uses css-modules
3
+
4
+ A simple and lightweight easily style-able Side scrolling datepicker, built with ❤️
5
+ | | |
6
+ :------------------------------------ |:------------------------------------:
7
+ ![ ] ( https://i.imgur.com/2vawdez.jpg ) | ![ ] ( https://i.imgur.com/3IYCCPJ.jpg )
8
+ ![ ] ( https://i.imgur.com/0aixw6v.jpg ) | ![ ] ( https://i.imgur.com/M467k3A.jpg )
9
+
4
10
5
11
### Installation
6
12
7
13
Run ` yarn add react-horizontal-datepicker `
14
+ or
15
+ Run ` npm i react-horizontal-datepicker `
8
16
9
17
### Usage
10
18
11
19
Import:
12
20
13
21
` import DatePicker from "react-horizontal-datepicker"; `
14
22
15
- and use as:
23
+ and simply use the component as:
16
24
17
25
``` javascript
18
- < DatePicker/ >
26
+ < DatePicker / >
19
27
```
20
28
21
- Available Props are
29
+ example at the end
30
+
31
+ #### Available Props are
22
32
23
33
| Prop | Type | Default | Description |
24
34
| ------------- | :-------:| :-------:| ----------- |
25
- | shouldScroll | Boolean | false | Set List to be scrollable |
26
- | getSelectedDay| Function| | Function to get the selected Day |
27
- | endDate | Number | 90 | Number of days to render from current date |
28
- | selectDate | Date | | prop to send selected date manually or from another calendar component |
29
-
30
- endDate currently has no effect on non scrolling list
35
+ | getSelectedDay | Function | | Function to get the selected Day |
36
+ | endDate | Number| 90 | Number of days to render from current date |
37
+ | selectDate | Date | | prop to send selected date manually or from another calendar component |
38
+ | color | String | 'rgb(54, 105, 238)' | Set the primary color can be any color format in string |
39
+ | labelFormat | String | 'MMMM yyyy' | Month label format - uses [ date-fns format] ( https://date-fns.org/v1.30.1/docs/format ) types |
31
40
32
- Example:
41
+ ### Example:
33
42
34
43
``` javascript
35
44
function App () {
@@ -40,14 +49,15 @@ function App() {
40
49
41
50
return (
42
51
< DatePicker getSelectedDay= {selectedDay}
43
- shouldScroll= {true }
44
52
endDate= {100 }
45
- selectDate= {new Date (" 2020-01-30" )}
53
+ selectDate= {new Date (" 2020-04-30" )}
54
+ labelFormat= {" MMMM" }
55
+ color= {" #374e8c" }
46
56
/ >
47
57
);
48
58
}
49
59
```
50
60
51
61
### Todo
52
- Add selectors for starting date and disabled dates
62
+ maybe use react window for efficiency
53
63
0 commit comments