Skip to content

Commit b4124a5

Browse files
committed
Add time picker docs
1 parent 4eb0c1b commit b4124a5

File tree

4 files changed

+30
-16
lines changed

4 files changed

+30
-16
lines changed

components/date_picker/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const DatePickerTest = () => (
1616

1717
| Name | Type | Default | Description|
1818
| ------------- |:-------:|:--------------- |:---------- |
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.|
2020
| value | Date | | Date object with the currently selected date. |
2121

2222
## Methods

components/time_picker/readme.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
11
# TimePicker
22

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.
54

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';
98

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+
);
1216
```
1317

1418
## Properties
1519

1620
| Name | Type | Default | Description|
1721
| ------------- |:-------:|:--------------- |:---------- |
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 |
2025

2126
## Methods
2227

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.
2529

26-
```
27-
input_instance.getValue();
28-
```
30+
- `getValue` is used to retrieve the current value.
31+
- `setValue` to force a new value.

docs/app/components/layout/main/modules/components.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import AutocompleteExample1 from './examples/autocomplete_example_1.txt';
2929
import CardExample1 from './examples/card_example_1.txt';
3030
import CheckboxExample1 from './examples/checkbox_example_1.txt';
3131
import DatePickerExample1 from './examples/datepicker_example_1.txt';
32+
import TimePickerTest from './examples/timepicker_example_1.txt';
3233

3334
export default {
3435
app_bar: {
@@ -149,6 +150,7 @@ export default {
149150
time_picker: {
150151
name: 'Time Picker',
151152
docs: TimePicker,
152-
path: '/components/time_picker'
153+
path: '/components/time_picker',
154+
examples: [TimePickerTest]
153155
}
154156
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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 />

0 commit comments

Comments
 (0)