File tree Expand file tree Collapse file tree 4 files changed +30
-16
lines changed
docs/app/components/layout/main/modules Expand file tree Collapse file tree 4 files changed +30
-16
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ const DatePickerTest = () => (
16
16
17
17
| Name | Type | Default | Description|
18
18
| ------------- | :-------:| :--------------- | :---------- |
19
- | className | String | ` '' ` | Sets a class to give customized styles to the checkbox field .|
19
+ | className | String | ` '' ` | Sets a class to give customized styles to the time picker .|
20
20
| value | Date | | Date object with the currently selected date. |
21
21
22
22
## Methods
Original file line number Diff line number Diff line change 1
1
# TimePicker
2
2
3
- ``` javascript
4
- var TimePicker = require (' react-toolbox/components/time_picker' );
3
+ A [ dialog picker] ( https://www.google.com/design/spec/components/pickers.html#pickers-time-pickers ) is used to select a single time (hours: minutes ). The selected time is indicated by the filled circle at the end of the clock hand.
5
4
6
- var time = new Date ();
7
- time . setHours ( 17 );
8
- time . setMinutes ( 28 ) ;
5
+ <!-- example -->
6
+ ``` jsx
7
+ import TimePicker from ' react-toolbox/time_picker ' ;
9
8
10
- // Initialized time picker with AM-PM format
11
- < TimePicker format= " ampm" value= {time} / >
9
+ let selectedTime = new Date ();
10
+ selectedTime .setHours (17 );
11
+ selectedTime .setMinutes (28 );
12
+
13
+ const TimePickerTest = () => (
14
+ < TimePicker value= {selectedTime} / >
15
+ );
12
16
```
13
17
14
18
## Properties
15
19
16
20
| Name | Type | Default | Description|
17
21
| ------------- | :-------:| :--------------- | :---------- |
18
- | ** format** | String | ` 24hr ` | Format to display the clock. It can be * 24hr* or * ampm* .|
19
- | ** value** | Date | ` new Date() ` | Datetime object with currrent time by default |
22
+ | className | String | ` '' ` | Sets a class to give customized styles to the time picker.|
23
+ | format | String | ` 24hr ` | Format to display the clock. It can be ` 24hr ` or ` ampm ` .|
24
+ | value | Date | | Datetime object with currrently selected time |
20
25
21
26
## Methods
22
27
23
- #### getValue
24
- Returns the value of the picker.
28
+ The TimePicker is a very easy component from the top level API but quite complex inside. It has state to keep the the currently selected value.
25
29
26
- ```
27
- input_instance.getValue();
28
- ```
30
+ - ` getValue ` is used to retrieve the current value.
31
+ - ` setValue ` to force a new value.
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import AutocompleteExample1 from './examples/autocomplete_example_1.txt';
29
29
import CardExample1 from './examples/card_example_1.txt' ;
30
30
import CheckboxExample1 from './examples/checkbox_example_1.txt' ;
31
31
import DatePickerExample1 from './examples/datepicker_example_1.txt' ;
32
+ import TimePickerTest from './examples/timepicker_example_1.txt' ;
32
33
33
34
export default {
34
35
app_bar : {
@@ -149,6 +150,7 @@ export default {
149
150
time_picker : {
150
151
name : 'Time Picker' ,
151
152
docs : TimePicker ,
152
- path : '/components/time_picker'
153
+ path : '/components/time_picker' ,
154
+ examples : [ TimePickerTest ]
153
155
}
154
156
} ;
Original file line number Diff line number Diff line change
1
+ let selectedTime = new Date();
2
+ selectedTime.setHours(17);
3
+ selectedTime.setMinutes(28);
4
+
5
+ const TimePickerTest = () => (
6
+ <TimePicker value={selectedTime} />
7
+ );
8
+
9
+ return <TimePickerTest />
You can’t perform that action at this time.
0 commit comments