| 1 |
--- |
| 2 |
id: Time picker |
| 3 |
section: components |
| 4 |
subsection: date-and-time |
| 5 |
cssPrefix: pf-v6-c-time-picker |
| 6 |
propComponents: ['TimePicker'] |
| 7 |
--- |
| 8 |
|
| 9 |
import { TimePicker } from '@patternfly/react-core'; |
| 10 |
|
| 11 |
## Examples |
| 12 |
|
| 13 |
Appending the TimePicker to the `document.body` may cause accessibility issues, including being unable to navigate into the menu via keyboard or other assistive technologies. Instead, appending to the `"parent"` is recommended. |
| 14 |
|
| 15 |
### Basic 12 hour |
| 16 |
|
| 17 |
```ts file="./TimePickerBasic12Hour.tsx" |
| 18 |
``` |
| 19 |
|
| 20 |
### Basic 24 hour |
| 21 |
|
| 22 |
```ts file="./TimePickerBasic24Hour.tsx" |
| 23 |
``` |
| 24 |
|
| 25 |
### Custom delimiter |
| 26 |
|
| 27 |
```ts file="./TimePickerCustomDelimiter.tsx" |
| 28 |
``` |
| 29 |
|
| 30 |
### Minimum/maximum times |
| 31 |
|
| 32 |
The `minTime`/`maxTime` props restrict the options shown for the user to select from as well as trigger the `invalidMinMaxErrorMessage` if the user enters a time outside this range. |
| 33 |
|
| 34 |
```ts file="./TimePickerMinMaxTimes.tsx" |
| 35 |
``` |
| 36 |
|
| 37 |
### With seconds |
| 38 |
|
| 39 |
```ts file="./TimePickerWithSeconds.tsx" |
| 40 |
``` |
| 41 |
|
| 42 |
### Basic 24 hours with seconds |
| 43 |
|
| 44 |
```ts file="./TimePickerBasic24HoursWithSeconds.tsx" |
| 45 |
``` |