TimePicker

TimePicker is a component that provides a dialog interface for time selection, supporting both dial and keyboard input modes with customizable styling.

TypeResource
DesignFigma
MobileMobile Storybook
CodeGitlab

TimePicker Preview

Usage

import id.co.biofarma.binduiandroid.components.timepicker.TimePicker
val showPicker = remember { mutableStateOf(false) }
 
TimePicker(
    label = "Meeting Time",
    show = showPicker,
    onTimeSelected = { time ->
        // Handle time selection
    }
)

Examples

Radius (optional)

Adjusts the corner radius of the TimePicker dialog.

TimePicker Example Radius

Time Format (optional)

Choose between 12-hour and 24-hour time formats.

TimePicker Example Format

Props

PropsRequiredDefaultTypeDescription
idfalse""StringTest tag identifier for the component
stylefalseModifierModifierCustom modifier for styling
labelfalse""StringLabel text shown in the dialog header
radiusfalse”xs”StringCorner radius size (“xs”, “sm”, “md”, “lg”)
defaultValuefalseLocalTime.now()LocalTimeInitial time value
is24HourFormatfalsefalseBooleanWhether to use 24-hour format
onTimeSelectedfalse(LocalTime) -> UnitCallback when time is selected
showfalsemutableStateOf(false)MutableState<Boolean>Controls the visibility of the dialog

Notes

  1. Dialog Interface

    • Opens as a modal dialog with a customizable radius
    • Provides both dial and keyboard input modes
    • Toggle between input modes using the icon button
    • Includes “CANCEL” and “OK” action buttons
  2. Input Modes

    • Dial mode: Traditional clock-face time selection
    • Keyboard mode: Direct numeric input for hour and minute
    • Switch between modes using the toggle icon in the bottom-left
  3. Theming

    • Automatically adapts to light/dark theme based on system settings
    • Custom color scheme for various dialog elements
    • Consistent typography using the design system’s fonts
    • Configurable corner radius for different visual styles
  4. State Management

    • Uses MutableState for controlling dialog visibility
    • Maintains time selection state internally
    • Returns selected time through the onTimeSelected callback
    • Preserves selected time until dialog is dismissed
  5. Best Practices

    • Provide meaningful labels for better user understanding
    • Handle the onTimeSelected callback to process time selections
    • Use appropriate radius size based on your app’s design language
    • Consider user preference when choosing between 12/24-hour formats
    • Test the component using the provided test tag ID
BIND © Biofarma Innovate Next-level Design .