@forgebuild/hotal-ui
Reusable Web Components for booking and reservation experiences.
Install
npm install @forgebuild/hotal-ui
No peer dependencies — the Svelte runtime is bundled in. Works via a plain <script type="module"> tag too:
<script type="module" src="https://esm.sh/@forgebuild/hotal-ui"></script>
Components
<reservation-bar>
A date / guests / time picker bar with a Reserve link, popovers positioned via Floating UI, and calendar/list panels rendered with the native Popover API inside an open shadow root.
<script type="module">
import '@forgebuild/hotal-ui';
const bar = document.querySelector('reservation-bar');
// Function-valued and explicitly-false-when-default-is-true props must be
// set as JS properties, not HTML attributes (attributes are strings only,
// and HTML boolean-attribute semantics can't express "false" when the
// prop's own default is true).
bar.showReserveButton = false;
bar.fetchAvailableDates = async (partySize) => {
const res = await fetch(`/api/available-dates?party_size=${partySize}`);
const { dates } = await res.json();
return dates;
};
bar.addEventListener('reservationchange', (e) => console.log(e.detail));
</script>
<reservation-bar reserve-href="/reservations" sync-with-url closed-weekdays="[0]"></reservation-bar>
Attributes / properties
| Name |
Attribute |
Type |
Default |
Description |
minGuests |
min-guests |
number |
1 |
Minimum selectable party size |
maxGuests |
max-guests |
number |
20 |
Maximum selectable party size |
defaultGuests |
default-guests |
number |
2 |
Initial party size |
timeSlots |
time-slots (JSON array) |
string[] |
'7:00 PM'–'11:00 PM' in 30-min steps |
Selectable time options |
defaultTime |
default-time |
string |
'7:00 PM' |
Initial time |
showReserveButton |
show-reserve-button |
boolean |
true |
Whether the Reserve link is rendered. Set as a JS property to get false — see note above. |
reserveHref |
reserve-href |
string |
'/reservations' |
Base URL the built query string is appended to |
applyOnSelect |
apply-on-select |
boolean |
!showReserveButton |
Whether selecting a date/guests/time navigates to reserveHref immediately. Defaults to the inverse of showReserveButton (hiding the button makes the bar auto-navigate, its historical behavior); set explicitly to decouple the two — e.g. hide the button but keep applyOnSelect={false} when a host page syncs an inline booking flow itself off reservationchange and no navigation should happen. Set as a JS property to get false. |
syncWithUrl |
sync-with-url |
boolean |
false |
Read initial date/guests/time from location.search on mount |
closedWeekdays |
closed-weekdays (JSON array) |
number[] |
[] |
Weekdays (0=Sun–6=Sat) to disable in the calendar |
fetchAvailableDates |
— (property only) |
(partySize: number) => Promise<string[]> |
undefined |
Drives the date picker: up to 14 open dates show as a list (e.g. a stay's days), more as a calendar with the rest disabled |
Events
reservationchange — CustomEvent<{ date: string; guests: number; time: string }>, fires whenever the selection changes.
Theming
reservation-bar {
--rb-bar-bg: rgba(14, 58, 62, 0.9);
--rb-bar-border: rgba(212, 154, 60, 0.4);
--rb-text-color: #fff;
--rb-accent-bg: #d49a3c;
--rb-accent-hover-bg: #e0ac57;
--rb-trigger-hover-bg: rgba(212, 154, 60, 0.15);
--rb-panel-bg: rgba(10, 10, 12, 0.92);
--rb-radius: 2px;
}
<booking-flow>
Search results, a Stripe payment form, booking submission, and confirmation — plus an empty-state calendar when a date has no availability. Decoupled from <reservation-bar>: the page mirrors date/guests/time into <booking-flow> itself, typically from a reservation-bar's reservationchange event or from the page's own URL.
<script type="module">
import '@forgebuild/hotal-ui';
const flow = document.querySelector('booking-flow');
flow.closedWeekdays = [0];
flow.fetchAvailableDates = async (partySize) => {
const res = await fetch(`/api/available-dates?party_size=${partySize}`);
const { dates } = await res.json();
return dates;
};
flow.searchSlots = async (date, guests) => {
const res = await fetch(`/api/search?date=${date}&party_size=${guests}`);
const { slots } = await res.json();
return slots;
};
flow.stripePublishableKey = 'pk_test_...';
flow.stripeAppearance = { theme: 'stripe' };
flow.createPaymentIntent = async (date, guests) => {
const res = await fetch('/api/create-payment-intent', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ date, party_size: guests }),
});
return res.json();
};
flow.book = async (details) => {
const res = await fetch('/api/book', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(details),
});
return res.status === 201 ? { ok: true } : { ok: false, status: res.status, message: 'Something went wrong.' };
};
flow.date = '2026-08-20';
flow.guests = 2;
flow.addEventListener('booking-confirmed', (e) => console.log(e.detail));
</script>
<booking-flow></booking-flow>
Properties (all JS-only — no HTML attributes, since every property here is either dynamic state or a callback)
| Name |
Type |
Description |
date |
string |
Current search date (ISO) |
guests |
number |
Current party size |
preferredTime |
string |
Used to pre-select the closest available slot |
closedWeekdays |
number[] |
Same convention as reservation-bar: 0=Sun–6=Sat, for the empty-state calendar |
fetchAvailableDates |
(partySize: number) => Promise<string[]> |
Drives the empty-state date picker: up to 14 open dates show as pills (e.g. a stay's days), more as a calendar |
searchSlots |
(date: string, guests: number) => Promise<BookingSlot[]> |
Returns available time slots |
stripePublishableKey |
string |
Stripe publishable key |
stripeAppearance |
object |
Passed straight through to Stripe's elements({ appearance }) |
createPaymentIntent |
(date: string, guests: number) => Promise<PaymentIntentResult> |
Creates the Stripe PaymentIntent to hold |
book |
(details: BookingDetails) => Promise<BookResult> |
Submits the reservation |
When stripePublishableKey / createPaymentIntent are not set, the payment section is not rendered, no card hold is taken, and stripePaymentIntentId is omitted from BookingDetails.
interface BookingSlot { time: string; availableTables: number; }
interface PaymentIntentResult { clientSecret: string; paymentIntentId: string; amountCents: number; }
interface BookingDetails {
date: string; startTime: string; timeDisplay: string; partySize: number;
contactName: string; contactEmail?: string; contactPhone?: string; notes?: string;
stripePaymentIntentId: string; clerkUserId?: string;
}
type BookResult = { ok: true } | { ok: false; status: number; message: string };
Events
booking-confirmed — CustomEvent<{ date: string; time: string; guests: number }>, fires once a booking succeeds.
Theming
booking-flow {
--bf-text-color: #1a1a1a;
--bf-muted-text: rgba(0, 0, 0, 0.6);
--bf-border-color: rgba(0, 0, 0, 0.15);
--bf-accent-bg: #1a1a1a;
--bf-accent-text: #fff;
--bf-spinner-track: rgba(0, 0, 0, 0.15);
--bf-spinner-active: #1a1a1a;
}
<menu-section>
A restaurant menu with category tabs (animated sliding indicator), an info grid, per-item allergen icons with tooltips, and an optional PDF-menu dialog. Two visual variants: the classic centered design, and variant="panel" — an eyebrow-above-heading header row with tabs on the right, a full-width boxed info grid, and a bordered item-card grid, rendered statically with instant category switching.
<script type="module">import '@forgebuild/hotal-ui';</script>
<menu-section
variant="panel"
title="On the menu"
eyebrow="ZUMA"
categories='[{"label":"Bites","items":[{"name":"BBQ Chicken Sliders","description":"Jerk-glazed, brioche bun","price":"$17"}]}]'
info='[{"label":"Hours","value":"12:00 pm – late"}]'
></menu-section>
Attributes / properties