-
Notifications
You must be signed in to change notification settings - Fork 972
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4eb0c1b
commit b4124a5
Showing
4 changed files
with
30 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,31 @@ | ||
# TimePicker | ||
|
||
```javascript | ||
var TimePicker = require('react-toolbox/components/time_picker'); | ||
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. | ||
|
||
var time = new Date(); | ||
time.setHours(17); | ||
time.setMinutes(28); | ||
<!-- example --> | ||
```jsx | ||
import TimePicker from 'react-toolbox/time_picker'; | ||
|
||
// Initialized time picker with AM-PM format | ||
<TimePicker format="ampm" value={time} /> | ||
let selectedTime = new Date(); | ||
selectedTime.setHours(17); | ||
selectedTime.setMinutes(28); | ||
|
||
const TimePickerTest = () => ( | ||
<TimePicker value={selectedTime} /> | ||
); | ||
``` | ||
|
||
## Properties | ||
|
||
| Name | Type | Default | Description| | ||
| ------------- |:-------:|:--------------- |:---------- | | ||
| **format** | String | `24hr` | Format to display the clock. It can be *24hr* or *ampm*.| | ||
| **value** | Date | `new Date()` | Datetime object with currrent time by default | | ||
| className | String | `''` | Sets a class to give customized styles to the time picker.| | ||
| format | String | `24hr` | Format to display the clock. It can be `24hr` or `ampm`.| | ||
| value | Date | | Datetime object with currrently selected time | | ||
|
||
## Methods | ||
|
||
#### getValue | ||
Returns the value of the picker. | ||
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. | ||
|
||
``` | ||
input_instance.getValue(); | ||
``` | ||
- `getValue` is used to retrieve the current value. | ||
- `setValue` to force a new value. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
docs/app/components/layout/main/modules/examples/timepicker_example_1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
let selectedTime = new Date(); | ||
selectedTime.setHours(17); | ||
selectedTime.setMinutes(28); | ||
|
||
const TimePickerTest = () => ( | ||
<TimePicker value={selectedTime} /> | ||
); | ||
|
||
return <TimePickerTest /> |