Extra
TimePickerSheet
A FormaUI time picker presented in a modal bottom sheet — Material 3's TimePicker (clock dial) and TimeInput (text entry) hosted in a FormaBottomSheet, with hoisted M3 TimePickerState, confirm/dismiss button slots, and a FormaUI-provided dial-to-input mode toggle (M3's TimePicker has none of its own). Mirrors FormaDatePickerSheet's structure.
dev.formaui.components.timepicker
Preview
This toggle is site chrome only — the preview has its own light/dark switch inside.
Live preview
Live preview — ~37 MB development build
Usage
val state = rememberTimePickerState(initialHour = 9, initialMinute = 30)
if (open) {
FormaTimePickerSheet(
onDismissRequest = { open = false },
state = state,
confirmButton = {
FormaButton(onClick = { onPicked(state.hour, state.minute); open = false }) { Text("OK") }
},
)
}FormaTimePickerSheet
Hosts M3's TimePicker/TimeInput in a FormaBottomSheet above a button row: an optional FormaUI mode toggle at the start and end-aligned dismiss/confirm slots. State is the caller's TimePickerState and the component wires nothing to the button slots — the confirm slot reads state.hour / state.minute itself. The default colors make the picker's own container transparent so it sits directly on the sheet surface.
Supporting API
- rememberTimePickerStatefunction (Material 3)
- The component defines no state type of its own — callers create and own the picker state via Material 3's rememberTimePickerState (initialHour, initialMinute, is24Hour) and read hour / minute from it.
Accessibility
Inherits Material 3's TimePicker/TimeInput semantics — the dial and the hour/minute selectors are labeled and the AM/PM toggle is announced — plus ModalBottomSheet's back-press and scrim dismiss handling; the FormaUI mode toggle carries a mode-dependent contentDescription ('Switch to text input' / 'Switch to clock dial'). The button slots are caller-supplied (typically FormaButtons with M3's 48dp minimum touch target).