Skip to main content

Appointment Input

A calendar slot selection that allows users to select a time slot for an appointment.


Basic Example

A simple appointment booking selector

from datetime import datetime, timedelta

from abstra.forms import read_appointment

# next 14 days
# only weekdays
# 10:00 - 18:00
# 15 minutes interval
# 45 minutes duration
# remove lunch break
slots = []
max_date = + timedelta(days=14)
current_date =
while current_date < max_date:
if current_date.weekday() < 5:
for hour in range(10, 18):
if hour == 12:
begin = current_date.replace(hour=hour, minute=0)
end = begin + timedelta(minutes=45)
slots.append((begin, end))
current_date += timedelta(days=1)
read_appointment("Welcome to Abstra, please select a demo slot", slots=slots)


labelThe label to display to the userstr
slotsThe available slots for the user to choose fromList[Union[AppointmentSlot, dict, Tuple[datetime, datetime]]]
initial_valueThe initial value to display to the user. Defaults to None.Union[AppointmentSlot, dict, Tuple[datetime, datetime]]
disabledwhether the input is disabled. Defaults to False.bool
requiredWhether the input is required or not eg. "this field is required". Defaults to True.Union[bool, str]
hintA tooltip displayed to the user. Defaults to None.str
end_programWhether the program should end after the widget is shown. Defaults to False.bool
full_widthWhether the input should use full screen width. Defaults to False.bool
button_textWhat text to display on the button when the widget is not part of a Page. Defaults to 'Next'.str

Return Values

AppointmentSlotA dict containing the selected appointment slot