Slot Picker
ProAn 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.
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
Usage example — open the gallery for the full interactive demo.
An interactive demo for this component lives in the gallery.
Open live demoMore examples
Hours, lunch and a buffer
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
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
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
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
| Name | Type | Default | Description |
|---|---|---|---|
| value | SvSlotPickerValue | null (two-way) | null | The picked time. Two-way bindable; `null` when none. |
| date | string (two-way) | '' | The day shown, `YYYY-MM-DD` in the business zone. Two-way bindable (`dateChange`); '' = the first day of the strip. |
| events | readonly CalendarEvent[] | [] | Existing bookings the slots must not overlap. Recurring series and per-event zones are honoured. |
| loading | boolean | false | True while `events` is being fetched — no slots are offered. |
| error | SvDataError | string | null | null | Load failure — normalise an `HttpErrorResponse` with `toSvDataError()`. No slots are offered. |
| durations | readonly number[] | [30] | The durations offered, minutes. More than one shows a duration control. |
| duration | number | null (two-way) | null | The chosen duration, minutes. Two-way bindable; `null` = the first of `durations`. |
| stepMinutes | number | null | null | Minutes between slot starts; `null` = the duration. |
| workingHours | SvWorkingHours | null | SV_DEFAULT_WORKING_HOURS | The hours times fall in; a day it does not work is "Closed". `null` = the whole day. |
| blocked | readonly SvBlockedInterval[] | [] | Time nothing can be booked into — shown as unavailable with its label. |
| resourceIds | readonly string[] | [] | The resources a booking takes — only their bookings and blocks count. Empty = the whole calendar. |
| bufferMinutes | number | 0 | Gap kept before and after each existing booking, minutes. |
| minNoticeMinutes | number | 0 | Minimum notice, minutes — earlier times are "too soon". |
| timeZone | string | '' | The business's IANA zone — hours, blocks, days and the value are in it. '' = the viewer's zone. |
| displayTimeZone | string (two-way) | '' | The zone times are shown in. Two-way bindable; '' = the business zone. |
| timeZones | readonly string[] | [] | Zones offered in a "Times shown in" select; empty hides it. |
| startDate | string | '' | The first day of the strip, `YYYY-MM-DD`; '' = today in the business zone. |
| days | number | 7 | Days in the strip. |
| minDate | string | '' | The earliest day offered; '' = today in the business zone. |
| maxDate | string | '' | The last day offered; '' = no limit. |
| now | Date | null | null | "Now" for past / minimum-notice checks; `null` = the real clock. |
| showUnavailable | boolean | true | Show taken, blocked and too-soon times, disabled, with the reason. |
| groupByPartOfDay | boolean | true | Group the times into Morning / Afternoon / Evening. |
| locale | string | svLocale() | BCP 47 locale for days and times (12 / 24 h follows it). |
| disabled | boolean | false | Nothing can be picked; the days can still be browsed. |
| ariaLabel | string | '' | Accessible name of the whole picker. |
Outputs
| Event | Payload type | Description |
|---|---|---|
| slotSelected | SvSlotPickerValue | A time was picked by the user — never emitted when the value is cleared. |
| retry | void | The host should re-run the failed load. |
| valueChange | SvSlotPickerValue | null | Emits the new `value` whenever it changes — the output half of `[(value)]`. |
| dateChange | string | Emits the new `date` whenever it changes — the output half of `[(date)]`. |
| durationChange | number | null | Emits the new `duration` whenever it changes — the output half of `[(duration)]`. |
| displayTimeZoneChange | string | Emits 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
Bound to the names this component actually exposes.
Host class
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.