Skip to content
New

Booking, form

beta

A 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.

npx rasengan-ui add booking-form
The dining room, set for dinner, with wooden tables and warm lights.

Book a table

Pick a day and a time: your WhatsApp opens with the request written, and we confirm by reply within the hour.

Groups of more than twelve: call us, we will set up the terrace.

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.

Installation

Terminal
npx rasengan-ui add booking-form

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):

app/_routes/index.page.tsx
import { BookingForm } from "@/components/blocks/booking-form";
import { home } from "@/content/home";
 
export default function Home() {
  return <BookingForm content={home.booking} />;
}
content/home.ts
import { example, type BookingFormContent } from "@/components/blocks/booking-form";
 
export const home = {
  booking: {
    ...example,
    channel: { kind: "whatsapp", to: "+237 6 70 00 00 00" },
  } satisfies BookingFormContent,
};

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.

<BookingForm content={home.booking} action="/api/bookings" />

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:

A client with a full afro, smiling, her hands in her hair.

Book an appointment

Choose your service and a time: we confirm by text, and keep the chair for you.

Service

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

FieldTypeLimitsGuidance
titlestring2–48 chars'Book a table', 'Book an appointment'.
sublineoptionalstring≤ 160 charsHow booking works: 'Pick a time, we confirm on WhatsApp within the hour.'
imageoptionalobjectThe room, the chair, the team; portrait or square. Left out, the form takes the width.
image.srcstringA local path ('/images/terrace.jpg') or the project's asset URL.
image.altstring≤ 140 charsWhat the image shows, for people who cannot see it. Empty only if purely decorative.
image.widthinteger
image.heightinteger
channelobjectWhere 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.tostring1–120 charsThe business's number in international form, or its email address.
hoursobjectThe days and times offered: closed days can't be picked, times stay inside the slots.
hours.daysobject[]1–7 items
hours.days[].day"monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday"
hours.days[].slotsobject[]≤ 3 itemsEmpty for a closed day.
hours.days[].slots[].openstring24-hour 'HH:MM'.
hours.days[].slots[].closestring24-hour 'HH:MM'.
hours.noteoptionalstring≤ 120 charsHolidays, exceptions.
intervaloptionalinteger10–120, default 30Minutes between two times offered.
daysAheadoptionalinteger1–365, default 60How far ahead a date can be picked.
fieldsobject
fields.nameobject
fields.name.labelstring1–32 chars'Your name'
fields.name.placeholderoptionalstring≤ 48 chars
fields.dateobject
fields.date.labelstring1–32 chars'Date'
fields.date.placeholderoptionalstring≤ 48 chars
fields.timeobject
fields.time.labelstring1–32 chars'Time'
fields.time.placeholderoptionalstring≤ 48 chars
fields.partyoptionalobjectFor a table: how many people, from 1 to max.
fields.party.labelstring1–32 chars'Guests'
fields.party.maxinteger2–40
fields.servicesoptionalobjectFor an appointment: one service to pick, shown with its duration and price.
fields.services.labelstring1–32 chars'Service'
fields.services.itemsobject[]1–8 items
fields.services.items[].namestring1–48 chars
fields.services.items[].descriptionoptionalstring≤ 140 chars
fields.services.items[].durationoptionalintegerMinutes.
fields.services.items[].priceobject
fields.services.items[].price.amountnumber≥ 0
fields.services.items[].price.currencystring3–3 charsAn ISO 4217 code: 'EUR', 'USD', 'XAF'.
fields.noteoptionalobject
fields.note.labelstring1–32 chars'Anything we should know?'
fields.note.placeholderoptionalstring≤ 48 chars
submitstring1–32 chars'Send my request', 'Book on WhatsApp'.
minutesoptionalstring≤ 8 chars, default "min"After a duration: 'min'.
localeoptionalstringA BCP 47 locale for dates, times and prices ('en-CM'); the page's language when left out.
smallPrintoptionalstring≤ 140 charsUnder the button: 'We confirm every booking by reply.'
labelsobjectShown only when needed: in the message, under a missing field, after sending.
labels.introstring1–120 charsThe message's first line: 'Hello, I would like to book a table.'
labels.requiredstring1–32 charsUnder an empty required field: 'Required'.
labels.sentstring1–160 charsOnce the app opens: 'Your message is ready in WhatsApp: send it, and we confirm by reply.'

Props

PropNotes
contentBookingFormContent; the example when left out
actiona URL: the form posts its fields there instead of opening a message
onSubmit(values) => void: the values in code instead of a message
idthe section's id, for anchor links; "booking" by default
headingLevel1, 2 or 3: the heading's tag; 2 by default
classNameon 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.