Skip to main content

TimeSlotPicker

ComplexScheduling<co-time-slot-picker>

TimeSlotPicker shows open times as a grid of slots, with booked, held, available and selected states, and an optional day strip.

import { TimeSlotPicker } from 'health-components';

Examples​

Slots Only​

Storybook

Nothing Selected​

Storybook

Controlled​

Storybook

Usage​

<TimeSlotPicker label="Priya Shah MD . Follow-Up 20 min" slots={slots} days={days} onChange={setTime} />

When to use​

  • Booking, rescheduling, patient self-booking.

When not to use​

  • Free-form time entry for a past encounter: TextField with a time mask.

Variants and states​

VariantWhat it is
availableOutlined.
selectedprimary fill.
bookedStruck through, disabled, announced as booked.
heldDashed amber: held for another booking in progress.
day stripDays with weekday; full days disabled.

Accessibility​

  • Slots are a radiogroup; each label includes its state.
  • Booked differs by fill, strike and disabled state, not colour alone.

Do and don't​

  • Do: Show the provider and length above the grid.
  • Don't: Hide booked slots entirely: people want to see the day is busy.

Props​

PropTypeDefaultDescription
slots *TimeSlot[]—Array<{time, state: available|booked|held|blocked}>
daysTimeSlotDay[]none (no day strip)Array<{id, weekday, date, disabled?}>
valuestring | nullundefinedSelected time (controlled)
defaultValuestring | nullnoneInitially selected time (uncontrolled)
onChange(time: string) => voidnone(time) => void, called when a slot is chosen
daystringundefinedSelected day id (controlled)
defaultDaystringthe first dayInitially selected day id (uncontrolled)
onDayChange(day: string) => voidnone(dayId) => void, called when a day is chosen
labelstring"Available times" (not shown)Group label shown above the grid, e.g. provider and visit length

Also accepts native attributes, including defaultChecked, autoFocus, plus className and event handlers on the root element.

Angular, Vue and HTML​

Register the elements once (Angular guide), then use <co-time-slot-picker>. Attributes take strings; arrays and objects are set as properties (Angular [prop], Vue :prop) or as JSON attributes. Callbacks are DOM events with the value in event.detail.

Angular template
<co-time-slot-picker value="…" default-value="…" [slots]="slots" (co-change)="onChange($event.detail)"></co-time-slot-picker>
KindNameDescription
property / JSON attributeslotsArray<{time, state: available|booked|held|blocked}>
property / JSON attributedaysArray<{id, weekday, date, disabled?}>; default none (no day strip)
attributevalueSelected time (controlled); default undefined
attributedefault-value / defaultValueInitially selected time (uncontrolled); default none
attributedaySelected day id (controlled); default undefined
attributedefault-day / defaultDayInitially selected day id (uncontrolled); default the first day
attributelabelGroup label shown above the grid, e.g. provider and visit length; default "Available times" (not shown)
attributedefault-checked / defaultChecked
attributeauto-focus / autoFocus
eventco-change(time) => void, called when a slot is chosen; default none (React: onChange)
eventco-day-change(dayId) => void, called when a day is chosen; default none (React: onDayChange)