1
- # boring -datepicker
1
+ # native -datepicker
2
2
3
3
> Styleable datepicker utilizing the native ` <input type="date"> `
4
4
@@ -28,8 +28,8 @@ Not supported (datepicker is hidden):
28
28
### Vanilla JS
29
29
30
30
``` js
31
- const BoringDatepicker = require (' boring -datepicker' );
32
- const picker = new BoringDatepicker ({
31
+ const NativeDatepicker = require (' native -datepicker' );
32
+ const picker = new NativeDatepicker ({
33
33
onChange : (newValue ) => {
34
34
console .log (newValue);
35
35
},
@@ -42,11 +42,11 @@ See [API](#api).
42
42
### React
43
43
44
44
``` jsx
45
- const BoringDatepicker = require (' boring -datepicker/src/react' );
45
+ const NativeDatepicker = require (' native -datepicker/src/react' );
46
46
const SomeComponent = () => {
47
47
const [date , setDate ] = useState (' 2020-11-01' );
48
48
return (
49
- < BoringDatepicker value= {date} onChange= {(newValue ) => setDate (newValue)} / >
49
+ < NativeDatepicker value= {date} onChange= {(newValue ) => setDate (newValue)} / >
50
50
);
51
51
};
52
52
```
@@ -55,7 +55,7 @@ See [React API](#react-api).
55
55
56
56
## API
57
57
58
- ### ` class BoringDatepicker `
58
+ ### ` class NativeDatepicker `
59
59
60
60
#### ` constructor(options) `
61
61
@@ -91,26 +91,26 @@ Set the value of the datepicker.
91
91
- ` "2020-11-01 13:15:00" `
92
92
- ` "2020-11-01T13:15:00" `
93
93
94
- Upon changes, BoringDatepicker will replace the date-portion of the string and return the result.
94
+ Upon changes, NativeDatepicker will replace the date-portion of the string and return the result.
95
95
96
96
#### ` element `
97
97
98
98
Contains a reference to the datepicker element.
99
99
100
100
## React API
101
101
102
- ### ` BoringDatepicker ` component
102
+ ### ` NativeDatepicker ` component
103
103
104
104
Props:
105
105
106
106
``` jsx
107
- < BoringDatepicker
107
+ < NativeDatepicker
108
108
value= {date}
109
109
onChange= {(newValue ) => {}}
110
110
className= " customClassName"
111
111
>
112
112
{optionalChildren}
113
- < / BoringDatepicker >
113
+ < / NativeDatepicker >
114
114
```
115
115
116
116
#### ` props.value `
@@ -140,8 +140,8 @@ Custom className for the created element.
140
140
Example with ` className="CustomClass" ` :
141
141
142
142
``` html
143
- <span class =" BoringDatepicker CustomClass" >
144
- <input class =" BoringDatepicker__input " type =" date" />
143
+ <span class =" NativeDatepicker CustomClass" >
144
+ <input class =" NativeDatepicker__input " type =" date" />
145
145
</span >
146
146
```
147
147
@@ -152,9 +152,9 @@ If `children` are given, they are inserted into the resulting DOM. This can be u
152
152
Example:
153
153
154
154
``` html
155
- <span class =" BoringDatepicker " >
155
+ <span class =" NativeDatepicker " >
156
156
<!-- Children will be inserted here -->
157
- <input class =" BoringDatepicker__input " type =" date" />
157
+ <input class =" NativeDatepicker__input " type =" date" />
158
158
</span >
159
159
```
160
160
@@ -163,22 +163,22 @@ Example:
163
163
The following DOM is created for each datepicker:
164
164
165
165
``` html
166
- <span class =" BoringDatepicker " >
167
- <input class =" BoringDatepicker__input " type =" date" />
166
+ <span class =" NativeDatepicker " >
167
+ <input class =" NativeDatepicker__input " type =" date" />
168
168
</span >
169
169
```
170
170
171
171
The recommended way to style the datepicker is to apply styles (e.g. width/height and a background-image) to the topmost element. Example:
172
172
173
173
``` css
174
- .BoringDatepicker {
174
+ .NativeDatepicker {
175
175
width : 16px ;
176
176
height : 16px ;
177
177
background : transparent url (... ) no-repeat center center ;
178
178
}
179
179
```
180
180
181
- Note: under normal circumstances you should not add any styles to ` .BoringDatepicker__input ` !
181
+ Note: under normal circumstances you should not add any styles to ` .NativeDatepicker__input ` !
182
182
183
183
## Development
184
184
0 commit comments