Booking, form
betaA name, a day, a time inside the opening hours and a party size or a service; sends the request as a WhatsApp, text or email message.
Book a table
Pick a day and a time: your WhatsApp opens with the request written, and we confirm by reply within the hour.
- Use it
- A restaurant taking table bookings, or a salon, barber or spa taking appointments, without a booking system.
- Avoid it
- Live availability or payment at booking: embed the booking system instead.
- Pairs with
- Hours, weekLocation, map
Installation
It installs into components/blocks/booking-form/, with what it uses (Button, Date Picker, Field, Input, Label, Radio Group, Select, Textarea, Time Picker) and lib/blocks.ts.
Usage
Without content, the block shows its example. Pass your own, typed by the block's schema, from a content file (here, the example with one field changed):
Where the request goes
There is no server behind the form. When the visitor sends it, the block writes the request as a message (your labels.intro, then one line per field) and opens it in the app named by channel: WhatsApp, their text messages or their mail app, addressed to you. They send it themselves, and you confirm by reply.
To use your own backend instead, pass action: the form posts name, date (yyyy-MM-dd), time (HH:mm), party, service and note to that URL. Or pass onSubmit to take the values in code.
A table or an appointment
Give fields.party for a restaurant (how many guests, from one to max), or fields.services for a salon, a barber or a spa (one service to pick, with its duration and price). Either, both, or neither.
The same block for a salon, with services and sent by text:
Book an appointment
Choose your service and a time: we confirm by text, and keep the chair for you.
Days and times
hours uses the same shape as the opening hours block. A day with no slot can't be picked, nor a day in the past or more than daysAhead days ahead. The times offered are every interval minutes inside the chosen day's slots, the last one interval before closing. The form knows your hours, not your bookings: a time already taken can still be asked for.
Content
| Field | Type | Limits | Guidance |
|---|---|---|---|
title | string | 2–48 chars | 'Book a table', 'Book an appointment'. |
sublineoptional | string | ≤ 160 chars | How booking works: 'Pick a time, we confirm on WhatsApp within the hour.' |
imageoptional | object | The room, the chair, the team; portrait or square. Left out, the form takes the width. | |
image.src | string | A local path ('/images/terrace.jpg') or the project's asset URL. | |
image.alt | string | ≤ 140 chars | What the image shows, for people who cannot see it. Empty only if purely decorative. |
image.width | integer | ||
image.height | integer | ||
channel | object | Where the request goes: the visitor's app opens with the message written. | |
channel.kind | "whatsapp" | "sms" | "email" | Where the visitor's message opens: their WhatsApp, their texts, or their mail app. | |
channel.to | string | 1–120 chars | The business's number in international form, or its email address. |
hours | object | The days and times offered: closed days can't be picked, times stay inside the slots. | |
hours.days | object[] | 1–7 items | |
hours.days[].day | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday" | ||
hours.days[].slots | object[] | ≤ 3 items | Empty for a closed day. |
hours.days[].slots[].open | string | 24-hour 'HH:MM'. | |
hours.days[].slots[].close | string | 24-hour 'HH:MM'. | |
hours.noteoptional | string | ≤ 120 chars | Holidays, exceptions. |
intervaloptional | integer | 10–120, default 30 | Minutes between two times offered. |
daysAheadoptional | integer | 1–365, default 60 | How far ahead a date can be picked. |
fields | object | ||
fields.name | object | ||
fields.name.label | string | 1–32 chars | 'Your name' |
fields.name.placeholderoptional | string | ≤ 48 chars | |
fields.date | object | ||
fields.date.label | string | 1–32 chars | 'Date' |
fields.date.placeholderoptional | string | ≤ 48 chars | |
fields.time | object | ||
fields.time.label | string | 1–32 chars | 'Time' |
fields.time.placeholderoptional | string | ≤ 48 chars | |
fields.partyoptional | object | For a table: how many people, from 1 to max. | |
fields.party.label | string | 1–32 chars | 'Guests' |
fields.party.max | integer | 2–40 | |
fields.servicesoptional | object | For an appointment: one service to pick, shown with its duration and price. | |
fields.services.label | string | 1–32 chars | 'Service' |
fields.services.items | object[] | 1–8 items | |
fields.services.items[].name | string | 1–48 chars | |
fields.services.items[].descriptionoptional | string | ≤ 140 chars | |
fields.services.items[].durationoptional | integer | Minutes. | |
fields.services.items[].price | object | ||
fields.services.items[].price.amount | number | ≥ 0 | |
fields.services.items[].price.currency | string | 3–3 chars | An ISO 4217 code: 'EUR', 'USD', 'XAF'. |
fields.noteoptional | object | ||
fields.note.label | string | 1–32 chars | 'Anything we should know?' |
fields.note.placeholderoptional | string | ≤ 48 chars | |
submit | string | 1–32 chars | 'Send my request', 'Book on WhatsApp'. |
minutesoptional | string | ≤ 8 chars, default "min" | After a duration: 'min'. |
localeoptional | string | A BCP 47 locale for dates, times and prices ('en-CM'); the page's language when left out. | |
smallPrintoptional | string | ≤ 140 chars | Under the button: 'We confirm every booking by reply.' |
labels | object | Shown only when needed: in the message, under a missing field, after sending. | |
labels.intro | string | 1–120 chars | The message's first line: 'Hello, I would like to book a table.' |
labels.required | string | 1–32 chars | Under an empty required field: 'Required'. |
labels.sent | string | 1–160 chars | Once the app opens: 'Your message is ready in WhatsApp: send it, and we confirm by reply.' |
Props
| Prop | Notes |
|---|---|
content | BookingFormContent; the example when left out |
action | a URL: the form posts its fields there instead of opening a message |
onSubmit | (values) => void: the values in code instead of a message |
id | the section's id, for anchor links; "booking" by default |
headingLevel | 1, 2 or 3: the heading's tag; 2 by default |
className | on the <section>, for spacing |
Accessibility
- Every control has its visible label; an empty required field says so under it, and the form does not send.
- The services are a radio group, read with their duration and price.
- After sending, a status line says where the message is waiting.