Skip to content

Commit d62a2e0

Browse files
authored
Merge pull request #331 from VanillaViking/master
Default input type for time picker
2 parents 9063fea + b173506 commit d62a2e0

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

docusaurus/docs/time-picker.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,7 @@ Flag indicating if the time input should use the 24 hours clock. Defaults to the
113113
**inputFontSize**
114114
`Type: number | undefined`
115115
Font size of the time input. Defaults to 57. Useful when using a custom font.
116+
117+
**defaultInputType**
118+
`Type: 'picker' | 'keyboard'`
119+
Which input type to use by default. Defaults to the clock-face picker.

src/Time/TimePickerModal.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export function TimePickerModal({
5757
clockIcon = 'clock-outline',
5858
use24HourClock,
5959
inputFontSize,
60+
defaultInputType,
6061
}: {
6162
locale?: undefined | string
6263
label?: string
@@ -73,6 +74,7 @@ export function TimePickerModal({
7374
clockIcon?: string
7475
use24HourClock?: boolean
7576
inputFontSize?: number
77+
defaultInputType?: PossibleInputTypes
7678
}) {
7779
const theme = useTheme()
7880

@@ -86,7 +88,7 @@ export function TimePickerModal({
8688
}
8789

8890
const [inputType, setInputType] = React.useState<PossibleInputTypes>(
89-
inputTypes.picker
91+
defaultInputType || inputTypes.picker
9092
)
9193
const [focused, setFocused] = React.useState<PossibleClockTypes>(
9294
clockTypes.hours

0 commit comments

Comments
 (0)