Slot Picker

Pro

An appointment picker: a strip of days, each with how many times are free, the free times of the chosen day, a duration and a time zone. Every time is judged by the scheduler's own `svCheckSlot` with double-booking refused, so a public bookings page and the diary behind it never disagree. Working hours, blocked time (lunch, a ward round), a buffer around each booking, minimum notice, resources and daylight-saving changeovers are all honoured; the value carries the business's wall time and the UTC instants.

</>sv-slot-picker bookingappointmentslotsavailabilitycalendlytime slottime zonescheduleclinicsalonreservation

Complexity tier: Application The interactive bar, plus a stated data-volume ceiling, a persistence contract, a bundle budget and an accessible parity surface.

Dataset size: up to 500 bookings in the visible days recommended, 5,000 maximum. Times are computed for the days in the strip only (7 by default), each one checked against the bookings of that day. Fetch the bookings for the visible days rather than the whole diary, and filter by `resourceIds` on the server when one diary is all the page needs. `maxDate` ends the bookable range, which also bounds the 60-day "Next free day" search.

import { SvSlotPickerComponent } from '@styloviz-pro/scheduler';

Demo & usage

Basic usage

Pro

Usage example — open the gallery for the full interactive demo.

Pro

An interactive demo for this component lives in the gallery.

Open live demo

More examples

Hours, lunch and a buffer

Pro

Times run from the start of working hours every `stepMinutes` (the duration by default) while the whole appointment fits before the end. A blocked interval is shown, disabled, with its label; `bufferMinutes` keeps a gap either side of every booking.

Show the times in the visitor's zone

Pro

The strip's days, the hours and the value stay in the business's `timeZone`; `displayTimeZone` only changes how the times read. A time that falls on another calendar day there says "+1 day" in words.

One diary per practitioner

Pro

With `resourceIds`, only bookings and blocks for those resources count — a ward round closes one doctor's morning, not the clinic's.

The rules without the component

Pro

The generator is exported — for a server that re-checks a booking before it saves it, or a "next free appointment" line elsewhere on the page.

When to use

  • A public bookings page: a consultation, a clinic, a salon, a demo call — a customer picks one free time.
  • A booking form inside an app where staff book on someone's behalf and must not double-book.
  • Use Calendar / Scheduler to see or edit the whole diary, and Date Picker (with Time Picker) when any date or time will do.

Compare with

  • Calendar / Scheduler — Calendar / Scheduler shows and edits a diary — every booking, by day, week or resource. Slot Picker is the other side of it: a customer picks one free time, and it offers only what the scheduler would accept, through the same `svCheckSlot` rules.
  • Date Picker — Date Picker picks any date in range. Slot Picker picks a free appointment: the times come from working hours, blocked time, buffers and existing bookings, never free entry.

Async states

  • loading
  • error
  • retry

Inputs

NameTypeDefaultDescription
valueSvSlotPickerValue | null (two-way)nullThe picked time. Two-way bindable; `null` when none.
datestring (two-way)''The day shown, `YYYY-MM-DD` in the business zone. Two-way bindable (`dateChange`); '' = the first day of the strip.
eventsreadonly CalendarEvent[][]Existing bookings the slots must not overlap. Recurring series and per-event zones are honoured.
loadingbooleanfalseTrue while `events` is being fetched — no slots are offered.
errorSvDataError | string | nullnullLoad failure — normalise an `HttpErrorResponse` with `toSvDataError()`. No slots are offered.
durationsreadonly number[][30]The durations offered, minutes. More than one shows a duration control.
durationnumber | null (two-way)nullThe chosen duration, minutes. Two-way bindable; `null` = the first of `durations`.
stepMinutesnumber | nullnullMinutes between slot starts; `null` = the duration.
workingHoursSvWorkingHours | nullSV_DEFAULT_WORKING_HOURSThe hours times fall in; a day it does not work is "Closed". `null` = the whole day.
blockedreadonly SvBlockedInterval[][]Time nothing can be booked into — shown as unavailable with its label.
resourceIdsreadonly string[][]The resources a booking takes — only their bookings and blocks count. Empty = the whole calendar.
bufferMinutesnumber0Gap kept before and after each existing booking, minutes.
minNoticeMinutesnumber0Minimum notice, minutes — earlier times are "too soon".
timeZonestring''The business's IANA zone — hours, blocks, days and the value are in it. '' = the viewer's zone.
displayTimeZonestring (two-way)''The zone times are shown in. Two-way bindable; '' = the business zone.
timeZonesreadonly string[][]Zones offered in a "Times shown in" select; empty hides it.
startDatestring''The first day of the strip, `YYYY-MM-DD`; '' = today in the business zone.
daysnumber7Days in the strip.
minDatestring''The earliest day offered; '' = today in the business zone.
maxDatestring''The last day offered; '' = no limit.
nowDate | nullnull"Now" for past / minimum-notice checks; `null` = the real clock.
showUnavailablebooleantrueShow taken, blocked and too-soon times, disabled, with the reason.
groupByPartOfDaybooleantrueGroup the times into Morning / Afternoon / Evening.
localestringsvLocale()BCP 47 locale for days and times (12 / 24 h follows it).
disabledbooleanfalseNothing can be picked; the days can still be browsed.
ariaLabelstring''Accessible name of the whole picker.

Outputs

EventPayload typeDescription
slotSelectedSvSlotPickerValueA time was picked by the user — never emitted when the value is cleared.
retryvoidThe host should re-run the failed load.
valueChangeSvSlotPickerValue | nullEmits the new `value` whenever it changes — the output half of `[(value)]`.
dateChangestringEmits the new `date` whenever it changes — the output half of `[(date)]`.
durationChangenumber | nullEmits the new `duration` whenever it changes — the output half of `[(duration)]`.
displayTimeZoneChangestringEmits the new `displayTimeZone` whenever it changes — the output half of `[(displayTimeZone)]`.

Wire it to your API

This component is headless about transport: it renders what you give it and reports what the user asks for. Nothing below requires @styloviz/data — drive it from whatever you already use.

Template

Pro

Bound to the names this component actually exposes.

Host class

Pro

Drive the three async inputs from your own fetch.

  • This component does not emit a query, so it renders what you give it. Call `load()` on your own trigger and bind `events`, `loading` and `error`.
  • Normalize failures with `toSvDataError()` from `@styloviz/core`. It derives `retryable` from the status, so a 404 does not get a "Try again" button that can only fail again.

Full walkthrough: Connecting to a backend.

Customization & theming

  • `durations` (minutes) shows a segmented control when there is more than one; `stepMinutes` sets the gap between starts.
  • `days` sets how many days the strip shows (7 by default); `startDate`, `minDate` and `maxDate` bound it, and a date picker jumps to any day in range.
  • `showUnavailable` hides taken, blocked and too-soon times instead of listing them disabled; `groupByPartOfDay` turns the Morning / Afternoon / Evening groups off.
  • `now` pins the clock, for tests and demos. `locale` sets the day and time format, 12- or 24-hour included.
  • Every string comes from the `schedulerPro` labels (`slot*` keys) in 12 language packs.
  • `svGenerateSlots`, `svFirstAvailableDate`, `svDurationParts` and `svSlotZone` are exported.

Best practices

  • Do: Pass the same working hours, blocked time and bookings the scheduler uses — the picker asks the same `svCheckSlot` question, so the two agree only when they are given the same facts.
  • Do: Check the slot again on the server before you save the booking (`svGenerateSlots` runs there too). Someone else may have taken it since the page loaded.
  • Do: Store `value.start` / `value.end` (UTC) and show `value.date` + `value.startTime` (the business's wall time) in the confirmation.
  • Don't: Don't offer times before the bookings arrive. Bind `[loading]` and `[error]` — while either is set the picker offers nothing, because a time computed without the bookings could already be taken.
  • Tip: Bind `[(date)]` to the URL so a shared link opens the same day.

Accessibility

  • Two WAI-ARIA patterns built on the kit's own primitives (`@angular/aria` is not a dependency in 2.0, as with the import wizard): the day strip is a tablist with automatic activation (←/→ — mirrored in RTL — Home and End), and the times are a single-select listbox inside its tab panel.
  • In the listbox, arrows only move; Enter or Space picks — choosing a time is a commitment, so selection does not follow focus. Home / End, Page Up / Page Down and typing digits move too. One tab stop for the day strip, one for the times.
  • A taken, blocked or too-soon time stays focusable with `aria-disabled` and says why in its name ("10:30, taken", "12:30, unavailable: Lunch"). Each day tab says how many times are free, or "Full", or "Closed", and is named by what it shows followed by the date in words ("Mon 2 16 free, Monday 2 November").
  • Picking a time is announced in a polite live region with the day, the times and the zone, and repeated in a visible summary. "+1 day" for a time that lands on another day in the display zone is text, not colour.
  • While bookings load or failed, the panel shows the shared skeleton or a `role="alert"` error with a Retry button; an empty day says whether it is closed or fully booked and offers the next free day as a button.

Feedback on Slot Picker

Spotted a gap in this page, or something that didn't work as described? Comments are GitHub Discussions in the public styloviz/community repo, so posting needs a GitHub account.

Loads giscus.app and GitHub — nothing is fetched until you click.