UX4G Logo
Components

Time Slot

Interactive calendar appointment slot grid with status indicators, public holiday highlights, and compact or expanded booking sheet dialogs

The UX4G Time Slot component delivers a full calendar month slot grid for appointment scheduling across government services (e.g., Passport Seva Kendra, RTO Driving License tests, Aadhaar Enrolment Centres, and Sub-Registrar deed registrations).

Key Capabilities

  • Monthly Calendar Grid: Full month calendar displaying dates with real-time slot availability styling, past date locking, today marker dots, and weekday column headers.
  • Status Indicators & Legend: Distinct visual markers for Available dates, NoSlots, PublicHoliday (orange warning highlight), and WeeklyOff (Saturday/Sunday disabling).
  • Interactive Time Slot Dialog: Modal bottom sheet automatically launched on date selection with date navigation arrows (< Prev Day / Next Day >).
  • Two Dialog View Modes:
    • SlotPickerViewMode.Compact: 2-column compact grid with slot capacity badge numbers.
    • SlotPickerViewMode.Expanded: Vertical full-width list of slot cards with availability badges.
  • Date Constraints & Overrides: Configurable holiday tapping policies (allowTapOnPublicHoliday, allowTapOnWeeklyOff) and explicit date status overrides (SlotDateEntry).

Import from com.ux4g.designsystemv1.components.timeslot.*.


Interactive Previews

1. Calendar Slot Grid (Ux4gTimeslot)

Calendar month overview showing date availability states, today indicators, and status legend.

Ux4gTimeslotJetpack Compose
UX4G Time Slot Calendar Grid Preview

2. Time Slot Dialog Modals (Auto-Opened on Date Click)

When a citizen clicks an available date cell on the calendar grid, the interactive time slot picker sheet opens automatically to allow slot selection:

Compact View Mode (SlotPickerViewMode.Compact)

UX4G Time Slot Compact Dialog

2-column compact grid layout displaying time slots with remaining capacity badge counters.

Expanded View Mode (SlotPickerViewMode.Expanded)

UX4G Time Slot Expanded Dialog

Full-width vertical card list layout showing slot availability badges and bottom status legend.


Kotlin Usage

1. Appointment Booking with Dynamic Slot Provider

AppointmentBookingScreen.kt
import androidx.compose.foundation.layout.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.ux4g.designsystemv1.components.timeslot.*
import java.time.LocalDate

@Composable
fun AppointmentScheduler() {
    var selectedDate by remember { mutableStateOf<LocalDate?>(null) }
    var confirmedSlot by remember { mutableStateOf<SlotTimeEntry?>(null) }

    val timeslotData = Ux4gTimeslotData(
        year = 2026,
        month = 9,
        selectedDate = selectedDate,
        weeklyOffWeekdays = listOf(6, 7), // Saturday & Sunday off
        dates = listOf(
            SlotDateEntry(LocalDate.of(2026, 9, 12), SlotDateStatus.PublicHoliday),
            SlotDateEntry(LocalDate.of(2026, 9, 14), SlotDateStatus.NoSlots),
            SlotDateEntry(LocalDate.of(2026, 9, 16), SlotDateStatus.NoSlots)
        ),
        viewMode = SlotPickerViewMode.Compact
    )

    Column(
        modifier = Modifier
            .fillMaxWidth()
            .padding(16.dp),
        verticalArrangement = Arrangement.spacedBy(16.dp)
    ) {
        Ux4gTimeslot(
            data = timeslotData,
            onDateSelected = { selectedDate = it },
            timeSlotProvider = { date ->
                // Provide available slots for the selected date
                listOf(
                    SlotTimeEntry(time = "9:00 AM", slotCount = 4, status = SlotTimeStatus.Available),
                    SlotTimeEntry(time = "9:30 AM", slotCount = 6, status = SlotTimeStatus.Available),
                    SlotTimeEntry(time = "10:00 AM", slotCount = 3, status = SlotTimeStatus.Available),
                    SlotTimeEntry(time = "10:30 AM", slotCount = 0, status = SlotTimeStatus.NoSlots),
                    SlotTimeEntry(time = "2:30 PM", slotCount = 2, status = SlotTimeStatus.Limited),
                    SlotTimeEntry(time = "3:30 PM", slotCount = 1, status = SlotTimeStatus.Limited)
                )
            },
            onSlotConfirmed = { date, slot ->
                confirmedSlot = slot
            }
        )
    }
}

Parameters

Ux4gTimeslot Props

PropTypeDescriptionDefault
data *Ux4gTimeslotDataConfiguration object containing year, month, date status overrides, and view mode.—
modifierModifierCompose layout modifier applied to the calendar card container.Modifier
onDateSelected((LocalDate) -> Unit)?Callback triggered when the citizen taps on an active date cell.null
onMonthChanged((year: Int, month: Int) -> Unit)?Callback invoked when navigating between calendar months.null
timeSlotProvider((LocalDate) -> List<SlotTimeEntry>)?Function returning time slot entries for the tapped date to display in the modal sheet.null
onSlotConfirmed((date: LocalDate, slot: SlotTimeEntry) -> Unit)?Callback invoked when the citizen selects a slot and clicks "Confirm".null
colorsUx4gTimeslotColorsCustom color palette configuration for calendar grid and dialog states.Ux4gTimeslotDefaults.colors()

Ux4gTimeslotData Data Model

FieldTypeDescriptionDefault
year *IntCalendar year to display (e.g. 2026).—
month *IntCalendar month (1 = Jan ... 12 = Dec).—
selectedDateLocalDate?Currently highlighted selected date.null
todayLocalDate?Reference date for current day (shows primary dot marker).LocalDate.now()
weeklyOffWeekdaysList<Int>ISO weekday indices (1 = Mon ... 7 = Sun) treated as weekly off.listOf(6, 7)
datesList<SlotDateEntry>Explicit list of date status overrides (e.g., public holidays or full dates).emptyList()
allowTapOnPublicHolidayBooleanWhether clicking on a public holiday cell is permitted.false
allowTapOnWeeklyOffBooleanWhether clicking on a weekly-off cell is permitted.false
viewModeSlotPickerViewModeModal bottom sheet slot layout: Compact or Expanded.SlotPickerViewMode.Expanded

SlotDateStatus Enum

StatusCell StylingContext
AvailableClean clickable numeralOpen booking slots available on this day
NoSlotsGrayed background (neutral900 (5% alpha))All slots booked / unavailable
PublicHolidayAmber/Warning background tint (warning (10% alpha))Official government gazetted holiday
WeeklyOffGrayed disabled numeralNon-working weekend day (Saturday / Sunday)

SlotPickerViewMode Enum

ModeDialog LayoutTypical Usage
Compact2-column grid with circular count badgesDense mobile screens and quick slot selection
ExpandedFull-width vertical cards with availability badgesDetailed appointment schedules and multi-service counters

On this page