Skip to content

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

eventType

required

string

Event type from your template

primaryEntityId

required

string

Primary entity for the booking

durationMinutes

required

number

Required slot duration

startDate
Date

default: today

Earliest acceptable date

endDate
Date

default: startDate + 7 days

Latest acceptable date

preferredTimeOfDay
("morning" | "afternoon" | "evening")[]

Filter to time-of-day buckets

maxResults
number

default: 10

Max slots to render

showMergeOpportunities
boolean

default: true

Highlight slots with merge potential

Events

Event

Payload

Fires when

onSelect(slot: Slot) => void

User picked a slot

onLoad(slots: Slot[]) => void

Slots finished loading from the engine

Slots

Slot

Description

empty

Rendered when no slots match. Default shows "No slots in range. Try broadening dates."

slot

Custom 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.