Components · Input
AvailabilityPicker
Slot selection UI. Calls the optimal-slots endpoint, renders ranked candidates with their scores, and fires onSelect when the user picks one.
Key points
- Wraps the bookings/optimal-slots endpoint with a UI
- Re-fetches automatically when filter props change
- Shows score, allocated resources, and merge-opportunity hints inline
- Pair with EventEditor when you need a full create flow
Import
import { AvailabilityPicker } from '@flexischeduler/scheduling-components';Basic usage
<AvailabilityPicker
eventType="home_visit"
primaryEntityId="ent_pt_9001"
durationMinutes={60}
onSelect={(slot) => setSelectedSlot(slot)}
/>Reference
Props
Name
Type
Description
eventTyperequired
stringEvent type from your template
primaryEntityIdrequired
stringPrimary entity for the booking
durationMinutesrequired
numberRequired slot duration
startDateDatedefault: today
Earliest acceptable date
endDateDatedefault: startDate + 7 days
Latest acceptable date
preferredTimeOfDay("morning" | "afternoon" | "evening")[]Filter to time-of-day buckets
maxResultsnumberdefault: 10
Max slots to render
showMergeOpportunitiesbooleandefault: true
Highlight slots with merge potential
Events
Event
Payload
Fires when
onSelect(slot: Slot) => voidUser picked a slot
onLoad(slots: Slot[]) => voidSlots finished loading from the engine
Slots
Slot
Description
emptyRendered when no slots match. Default shows "No slots in range. Try broadening dates."
slotCustom render for a single slot. Receives the slot object.
Filtered selection
Constrain by date range and time-of-day to honor user preferences:
<AvailabilityPicker
eventType="home_visit"
primaryEntityId="ent_pt_9001"
durationMinutes={60}
startDate={tomorrow}
endDate={nextWeek}
preferredTimeOfDay={['morning']}
maxResults={5}
onSelect={handleSelect}
/>Selection doesn’t book
onSelect fires when the user picks a slot — but the component does not call create on the engine. That’s your job. Typically you’d store the slot in local state, show a confirmation step, then call POST /bookings when the user commits.