diff --git a/packages/datetime/src/timePicker.tsx b/packages/datetime/src/timePicker.tsx index 7bc011cf9e..1633e27bf4 100644 --- a/packages/datetime/src/timePicker.tsx +++ b/packages/datetime/src/timePicker.tsx @@ -49,6 +49,12 @@ export const TimePrecision = { export type TimePrecision = typeof TimePrecision[keyof typeof TimePrecision]; export interface ITimePickerProps extends IProps { + /** + * Whether to focus the first input when it opens initially. + * @default false + */ + autoFocus?: boolean; + /** * Initial time the `TimePicker` will display. * This should not be set if `value` is set. @@ -126,6 +132,7 @@ export interface ITimePickerState { export class TimePicker extends React.Component { public static defaultProps: ITimePickerProps = { + autoFocus: false, disabled: false, maxTime: getDefaultMaxTime(), minTime: getDefaultMinTime(), @@ -231,6 +238,7 @@ export class TimePicker extends React.Component ); } diff --git a/packages/docs-app/src/examples/datetime-examples/timePickerExample.tsx b/packages/docs-app/src/examples/datetime-examples/timePickerExample.tsx index acfb4d99d9..9b60a4a578 100644 --- a/packages/docs-app/src/examples/datetime-examples/timePickerExample.tsx +++ b/packages/docs-app/src/examples/datetime-examples/timePickerExample.tsx @@ -24,6 +24,7 @@ import { TimePicker, TimePrecision } from "@blueprintjs/datetime"; import { getDefaultMaxTime, getDefaultMinTime } from "@blueprintjs/datetime/lib/esm/common/timeUnit"; export interface ITimePickerExampleState { + autoFocus: boolean; precision?: TimePrecision; selectAllOnFocus?: boolean; showArrowButtons?: boolean; @@ -47,6 +48,7 @@ enum MaximumHours { export class TimePickerExample extends React.PureComponent { public state = { + autoFocus: true, disabled: false, precision: TimePrecision.MINUTE, selectAllOnFocus: false, @@ -80,6 +82,7 @@ export class TimePickerExample extends React.PureComponent +