Booking Widget
The Reservalue booking widget is a JavaScript component that embeds the full online booking flow into your own website or landing page — customers book without ever leaving your site. This page covers how to include, initialize, and customize it.
Overview
The widget ships as a UMD bundle that registers a global ReservalueWidget class.
Include one CSS file and one JS file, add a container element to your page, and call the
constructor. The widget auto-loads its own dependencies — you don't need to include them yourself.
Quick start
Go live in three steps:
<!-- 1. Include the stylesheet and script in <head> -->
<link rel="stylesheet" href="https://static.reservalue.net/widget/v1/reservalue-widget.css">
<script src="https://static.reservalue.net/widget/v1/reservalue-widget.min.js"></script>
<!-- 2. Add a container element -->
<div id="reservalue-widget"></div>
<!-- 3. Initialize -->
<script>
document.addEventListener('DOMContentLoaded', function () {
new ReservalueWidget('your-bu-link', 'your-service-link', {
container: '#reservalue-widget',
lang: 'en'
});
});
</script>
Replace your-bu-link with your business-unit link and
your-service-link with your service link — both are available in the admin dashboard.
Resources to include
In production you only need these two files (stable v1 paths):
| Resource | URL |
|---|---|
| Stylesheet (CSS) | https://static.reservalue.net/widget/v1/reservalue-widget.css |
| Script (JS) | https://static.reservalue.net/widget/v1/reservalue-widget.min.js |
Constructor
new ReservalueWidget(buLink, serviceLink, options)
buLink— required string, the business-unit link.serviceLink— required string, the service link.options— configuration object, see fields below.
Options
The options object supports the following fields:
| Option | Type | Required | Description |
|---|---|---|---|
container |
string | required | CSS selector of the element to mount into, e.g. '#reservalue-widget'. |
lang |
string | optional | UI language, defaults to 'zh-TW'. Supports zh-TW / en / ja / ko. |
styles |
object | optional | Custom colors and appearance — see "Theming". |
slotButtonStyle |
string | optional | Time-slot button style. One of primary / secondary / outline-primary / outline-secondary. |
nextButtonStyle |
string | optional | "Next" button style, defaults to primary. |
backButtonStyle |
string | optional | "Back" button style, defaults to secondary. |
showResultScreen |
boolean | optional | Whether to show the result screen after submission, defaults to true. Set false to handle it yourself via callbacks. |
Theming
Use the styles object to match the widget to your brand. Every field is optional;
omitted values fall back to defaults.
styles: {
header: { backgroundColor, color, borderBottomColor },
content: { backgroundColor, color },
footer: { backgroundColor, borderTopColor },
button: {
primary: { backgroundColor, color, borderColor },
secondary: { backgroundColor, color, borderColor }
},
result: { icon: { borderColor } },
calendar: {
backgroundColor, color, availableColor, disabledColor,
today: { backgroundColor },
selected: { backgroundColor }
}
}
Each value is a regular CSS color string such as '#e4007f' or 'rgb(228,0,127)'.
Languages
Switch the UI language with the lang option. Currently supported:
zh-TW— Traditional Chinese (default)en— Englishja— Japaneseko— Korean
An unsupported value falls back to zh-TW.
Events
The widget instance exposes these event registration methods for analytics or custom flows:
| Method | Fires when |
|---|---|
onReady(cb) | The widget has initialized and is ready to use. |
onStepChange(cb) | The step changes; receives the current step number. |
onReservationRequestSubmitted(cb) | The user submits the booking form. |
onReservationCreated(cb) | A reservation is created; receives { reservationId }. |
onReservationFailed(cb) | Reservation creation failed; receives { reason }. |
onError(cb) | Any error occurs. |
const widget = new ReservalueWidget('your-bu-link', 'your-service-link', {
container: '#reservalue-widget'
});
widget.onReady(() => console.log('widget ready'));
widget.onReservationCreated((data) => console.log('created', data.reservationId));
widget.onReservationFailed((data) => console.log('failed', data.reason));
Full example
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://static.reservalue.net/widget/v1/reservalue-widget.css">
<script src="https://static.reservalue.net/widget/v1/reservalue-widget.min.js"></script>
</head>
<body>
<div id="reservalue-widget"></div>
<script>
document.addEventListener('DOMContentLoaded', function () {
const widget = new ReservalueWidget('your-bu-link', 'your-service-link', {
container: '#reservalue-widget',
lang: 'en',
showResultScreen: true,
slotButtonStyle: 'outline-primary',
styles: {
header: { backgroundColor: '#000000', color: '#ffffff' },
button: {
primary: { backgroundColor: '#e4007f', color: '#ffffff', borderColor: '#e4007f' }
}
}
});
widget.onReservationCreated((data) => {
console.log('Reservation created:', data.reservationId);
});
});
</script>
</body>
</html>