-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
DatePicker.Required.Example.tsx
42 lines (37 loc) · 1.16 KB
/
DatePicker.Required.Example.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import * as React from 'react';
import { DatePicker, DayOfWeek, defaultDayPickerStrings } from '@uifabric/date-time';
import './DatePicker.Examples.scss';
export interface IDatePickerRequiredExampleState {
firstDayOfWeek?: DayOfWeek;
}
export class DatePickerRequiredExample extends React.Component<{}, IDatePickerRequiredExampleState> {
constructor(props: {}) {
super(props);
this.state = {
firstDayOfWeek: DayOfWeek.Sunday
};
}
public render(): JSX.Element {
const { firstDayOfWeek } = this.state;
return (
<div className="docs-DatePickerExample">
<p>Validation will happen when Date Picker loses focus.</p>
<DatePicker
label="Date required (with label)"
isRequired={true}
firstDayOfWeek={firstDayOfWeek}
strings={defaultDayPickerStrings}
placeholder="Select a date..."
ariaLabel="Select a date"
/>
<DatePicker
isRequired={true}
firstDayOfWeek={firstDayOfWeek}
strings={defaultDayPickerStrings}
placeholder="Date required with no label..."
ariaLabel="Select a date"
/>
</div>
);
}
}