Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default input type for time picker #331

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docusaurus/docs/time-picker.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,7 @@ Flag indicating if the time input should use the 24 hours clock. Defaults to the
**inputFontSize**
`Type: number | undefined`
Font size of the time input. Defaults to 57. Useful when using a custom font.

**defaultInputType**
`Type: 'picker' | 'keyboard'`
Which input type to use by default. Defaults to the clock-face picker.
4 changes: 3 additions & 1 deletion src/Time/TimePickerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export function TimePickerModal({
clockIcon = 'clock-outline',
use24HourClock,
inputFontSize,
defaultInputType,
}: {
locale?: undefined | string
label?: string
Expand All @@ -73,6 +74,7 @@ export function TimePickerModal({
clockIcon?: string
use24HourClock?: boolean
inputFontSize?: number
defaultInputType?: PossibleInputTypes
}) {
const theme = useTheme()

Expand All @@ -86,7 +88,7 @@ export function TimePickerModal({
}

const [inputType, setInputType] = React.useState<PossibleInputTypes>(
inputTypes.picker
defaultInputType || inputTypes.picker
)
const [focused, setFocused] = React.useState<PossibleClockTypes>(
clockTypes.hours
Expand Down