Appointment Booking
ProNewA booking flow with services, specialists, a day strip or month calendar, time slots, a details form and a confirmation, inline or in a dialog.
Installation
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
Props
<AppointmentBooking>
| Prop | Type | Default |
|---|---|---|
| services* | BookingService[]What can be booked. One service skips the list and opens on the date. | — |
| staff | BookingStaff[]People to book with. Adds a specialist picker with an "Any available" choice. | — |
| business | BookingBusinessProfile card shown beside the form (above it in narrow containers). Leave out for the form only. | — |
| layout | "inline" | "button" | "floating"`inline` renders in place; `button` and `floating` render a trigger that opens the widget in a dialog. | "inline" |
| calendar | "week" | "month"`week` is a swipeable strip of days; `month` is a full calendar grid. | "week" |
| getSlots | (date: Date, context: { service: BookingService; staff?: BookingStaff }) => string[] | Promise<string[]>Returns the free start times ("HH:MM", 24 hour) for a day. May return a promise; a skeleton shows while it resolves and a retry if it rejects. Defaults to Monday to Saturday, 9:00 to 17:00. | defaultSlots |
| isDateDisabled | (date: Date) => booleanDays that cannot be picked, e.g. `(d) => d.getDay() === 0`. Past days never can. | — |
| maxDays | numberHow many days ahead can be booked. | 60 |
| onConfirm | (booking: Booking) => void | Promise<void>Called on confirm. Return a promise to show the pending state; reject it to show the error. | — |
| required | DetailField[]Which of name, phone and email must be filled. | ["name", "email"] |
| accent | stringAccent color for the selected day, links and buttons. Any CSS color. | "var(--primary)" |
| accentForeground | stringText color on top of the accent. | "var(--primary-foreground)" |
| locale | stringBCP 47 locale for dates and times. | "en-US" |
| weekStart | 0 | 1First day of the week in the month calendar: 0 is Sunday, 1 is Monday. | 0 |
| formatDuration | (minutes: number) => stringFormats a length in minutes, e.g. `(m) => `${m} min``. | defaultDuration |
| labels | Partial<typeof LABELS>Override any of the built-in strings. | — |
| triggerClassName | stringClass for the trigger of the `button` and `floating` layouts, e.g. to reposition it. | — |
| className | string | — |
<Flow>
| Prop | Type | Default |
|---|---|---|
| text* | Labels | — |
| title* | React.ReactNode | — |
| onClose | () => void | — |
<Picker>
| Prop | Type | Default |
|---|---|---|
| today* | Date | — |
| value* | Date | — |
| onChange* | (d: Date) => void | — |
| blocked* | (d: Date) => boolean | — |
| locale* | string | "en-US" |
| text* | Labels | — |
Accessibility
- The day strip is a radio group and the month grid moves with the arrow keys, Page Up and Page Down; unavailable days are announced as such.
- Focus moves to each new step, and times load into a polite live region with a named skeleton.
- Fields keep real labels, mark errors with aria-invalid and a message, and the first invalid field takes focus.
- The button and floating layouts open a dialog that traps focus and returns it to the trigger.
- Steps fade without sliding, and the check mark does not draw, under reduced motion.