| 1 |
--- |
| 2 |
id: Calendar month |
| 3 |
section: components |
| 4 |
subsection: date-and-time |
| 5 |
cssPrefix: pf-v6-c-calendar-month |
| 6 |
propComponents: ['CalendarMonth', 'CalendarFormat', 'CalendarMonthInlineProps'] |
| 7 |
--- |
| 8 |
import { useState } from 'react'; |
| 9 |
|
| 10 |
## Examples |
| 11 |
|
| 12 |
### Selectable date |
| 13 |
|
| 14 |
```ts file="./CalendarMonthSelectableDate.tsx" |
| 15 |
|
| 16 |
``` |
| 17 |
|
| 18 |
### Date range |
| 19 |
|
| 20 |
In this example, there are 2 dates selected: a range start date (via the `rangeStart` prop) and a range end date (via the `date` prop). Additionally, any dates prior to the range start date are disabled by passing in an array of functions to the `validators` prop. In this case a single function is passed in, which checks whether a date is greater than or equal to the range start date. |
| 21 |
|
| 22 |
For this example, these dates are static and cannot be updated. For an interactive demo, see our [Date picker demos](/components/date-and-time/date-picker/react-demos). |
| 23 |
|
| 24 |
```ts file="./CalendarMonthDateRange.tsx" |
| 25 |
|
| 26 |
``` |