Debian Codegraph @

node/@patternfly/react-core/src/components/DatePicker/examples/DatePicker.md

raw
1 ---
2 id: Date picker
3 section: components
4 subsection: date-and-time
5 cssPrefix: pf-v6-c-date-picker
6 propComponents: ['DatePicker', 'CalendarFormat', 'DatePickerRef', 'DatePickerRequiredObject']
7 ---
8
9 import { Fragment, useState, useRef } from 'react';
10
11 ## Examples
12
13 ### Basic
14
15 ```ts file="./DatePickerBasic.tsx"
16
17 ```
18
19 ### Required
20
21 To require users to select a date before continuing, use the `requiredDateOptions.isRequired` property.
22
23 A required date picker will be invalid when the text input is empty and either the text input loses focus or the date picker popover is closed.
24
25 The error message can be customized via the `requiredDateOptions.emptyDateText` property.
26
27 ```ts file="./DatePickerRequired.tsx"
28
29 ```
30
31 ### American format
32
33 ```ts file="./DatePickerAmerican.tsx"
34
35 ```
36
37 ### Helper text
38
39 ```ts file="./DatePickerHelperText.tsx"
40
41 ```
42
43 ### Min and max date
44
45 ```ts file="./DatePickerMinMax.tsx"
46
47 ```
48
49 ### French
50
51 ```ts file="./DatePickerFrench.tsx"
52
53 ```
54
55 ### Controlled
56
57 ```ts file="./DatePickerControlled.tsx"
58
59 ```
60
61 ### Controlled required
62
63 ```ts file="./DatePickerControlledRequired.tsx"
64
65 ```
66
67 ### Controlling the date picker calendar state
68
69 ```ts file="./DatePickerControlledCalendar.tsx"
70
71 ```