Let visitors book a time on your own website: they pick a time, fill in their details and confirm, without leaving your page. The booking lands in your Makeplans account like any other.
It is a web component that talks to the Makeplans public API from the browser. No API key, no server of your own.
Find your case:
| You want | Go to |
|---|---|
| A booking form on a page | A booking form in the page |
| A "Book" button that opens the form | A Book button |
| To show the next free times | The next free times |
| It to look like your site | Make it yours |
| Several rooms, people or services on one page | Several resources or services |
| Full control of the HTML and CSS | Your own markup |
Every case has a demo page in demo/ with the code to copy. Run npm install
once (it builds the widget), then open demo/index.html straight from disk;
the demos use made-up times and send nothing.
-
Tell Makeplans where the widget will be. In Makeplans, go to Setup → Developer → Embed and enter your website's address. The widget only works on that address.
www.example.comandexample.comcount as two different addresses, so enter the one visitors end up on. -
Find your account name and service id. The account name is the first part of your booking site's address:
youraccountinyouraccount.makeplans.com. The service id is the number Makeplans has given the service you want booked. -
Add the script once on the page, anywhere:
<script src="https://unpkg.com/@makeplans/widget@0.1" defer></script>
Or host the file yourself: it is
dist/makeplans-widget.jsin the npm package@makeplans/widget.
If the widget says it could not load the free times, the address in step 1 is the first thing to check.
Put the tag where the form should be. Demo: demo/inline.html.
<makeplans-booking account="youraccount" service-id="15"></makeplans-booking>The widget follows your page's language (<html lang="…">) and uses your
page's font.
To change which details it asks for:
<makeplans-booking account="youraccount" service-id="15" fields="name email phonenumber*"></makeplans-booking>Name and email are always asked for. phonenumber and notes are optional
extras; a * makes one required.
With mode="popup" the form stays out of the page until it is asked for. Any
link or button with data-booking-open opens it. Demo: demo/popup.html.
<a href="https://youraccount.makeplans.com" data-booking-open>Book a time</a>
<makeplans-booking mode="popup" account="youraccount" service-id="15"></makeplans-booking>Give the link your booking site as its address, as above, and it still works if the script should fail to load.
<makeplans-times> shows the next free times as buttons. A click opens the
booking widget on the page with that time already chosen; the last button,
"More times", opens it on the full list. Demo: demo/popup.html.
<makeplans-times account="youraccount" service-id="15" count="3"></makeplans-times>
<makeplans-booking mode="popup" account="youraccount" service-id="15"></makeplans-booking>Demos: demo/themes.html and demo/styling.html.
Pick a theme. light (default), dark, auto (dark or light after the
visitor's device), warm or mono:
<makeplans-booking account="youraccount" service-id="15" theme="dark"></makeplans-booking>Set your colour. On any theme. The text on it turns dark or light by itself:
<makeplans-booking account="youraccount" service-id="15" accent="#0a7d5a"></makeplans-booking>Adjust a theme. A theme is a set of variables that your stylesheet can
set. The full list is at the top of src/themes.css:
makeplans-booking { --mb-radius: 4px; --mb-action: #ffd24a; --mb-on-action: #222; }Restyle single pieces. Your page's CSS does not reach inside the widget, except for the pieces it names:
makeplans-booking::part(slot) { border-radius: 999px; }
makeplans-booking::part(slot selected) { background: #222; }
makeplans-booking::part(button) { text-transform: uppercase; }The pieces are card, steps, heading, day, slot, button (the main
action), field (the inputs), status (errors) and resource. The chosen
day and time are also selected. On <makeplans-times> they are time and
more.
theme and accent work the same on <makeplans-times>.
There is also template, which chooses the layout as theme chooses the
colours. So far there is one, steps.
A service in Makeplans can have several resources: rooms, saunas, members of
staff. Without a resource-id the customer gets any free one. With it, the
widget shows and books only that one, and says its name:
<makeplans-booking account="youraccount" service-id="15" resource-id="3"></makeplans-booking>A common page shows each resource with its own free times and takes the
booking in one shared popup. Demo: demo/resources.html (three saunas).
<!-- under each photo -->
<makeplans-times account="youraccount" service-id="15" resource-id="3"></makeplans-times>
<!-- once on the page -->
<makeplans-booking mode="popup" account="youraccount" service-id="15"></makeplans-booking>Your own links can say what they are for in the same way:
<a href="…" data-booking-open data-booking-service-id="15" data-booking-resource-id="3">Book the smoke sauna</a>Widgets for different services can sit on the same page; each keeps its own times.
| Attribute | |
|---|---|
account |
Your account's name: youraccount for youraccount.makeplans.com. A full address also works (https://booking.example.com). |
service-id |
The id of the service to book. |
resource-id |
Only this resource of the service. Without it, any free resource. |
mode |
inline (default) sits in the page. popup is a dialog, opened by anything with data-booking-open. |
theme |
light (default), dark, auto, warm or mono. |
accent |
Your main colour, as #rrggbb. |
template |
The layout. So far only steps (default). |
fields |
Which fields to ask for. Default name email phonenumber notes; * makes one required. |
days-ahead |
How many days ahead to offer times. Default 14. |
hours |
Only offer times within these hours of the day, such as 7-21, in the time zone shown. Useful when visitors are in other time zones. |
timezone |
The time zone the page starts in, such as Europe/Oslo. Default: the visitor's own. See below. |
locale |
The customer's language for emails from Makeplans. Default: the page's language. |
verification |
Only for accounts set to confirm bookings with a link in an email: link. See below. |
count |
On <makeplans-times>: how many times to show. Default 3. |
account, service-id, resource-id and timezone on <makeplans-booking>
can be changed while the page is open: the widget then shows the times of what
they name. The other attributes are read once, when the widget starts.
Times are shown in the visitor's own time zone, named under the heading. The name is also a list: the visitor can choose another zone, and the days and times change to it. A time already chosen stays chosen. Every widget on the page shows the same zone, and the choice lasts until the page is loaded again.
For a service people come to you for, timezone="Europe/Oslo" starts the page
in your zone instead; the visitor can still change it. The first element on
the page that names a zone decides.
Whatever zone is shown, the booking is for the same moment. The emails and the calendar file come from Makeplans and are not changed by the zone chosen here.
After the form, Makeplans sends the customer a code by email or SMS, and the widget asks for it. That is what an account does unless set up otherwise, and it needs no attribute.
If your account is set to send a link by email instead, add
verification="link". The widget then tells the customer to click the link,
and shows the booking as confirmed once they have.
If the service needs payment, the widget links on to Makeplans' payment page. If bookings need your approval, it tells the customer the request is sent.
The texts come in cs, da, de, en, es, fr, he, it, lt, lv, ms, nb, nl, pl, pt,
ru, sl, sq, sv and ar, chosen by <html lang="…">, with English for any other
language. Dates and times are written the way that language writes them. The
names in the list of time zones are not translated (Europe/Oslo).
The widget can be used with the keyboard alone, and is built for screen readers: days and times are radio groups moved through with the arrow keys, errors are tied to the field they belong to, and the popup returns the cursor to where it was opened from. The themes meet the WCAG AA contrast levels; if you set your own colours, check theirs.
Put the three steps inside the element and load makeplans-widget.core.js,
which has no themes. With a bundler that is import '@makeplans/widget/core'
(and import '@makeplans/widget' for the whole widget); both only work in a
browser. The widget shows the right step, fills in days and times
by cloning your <template data-part> elements, and reads its texts from your
data- attributes. Nothing is styled for you.
demo/custom.html is a complete, small example to copy from. The parts:
| In the markup | |
|---|---|
data-step="time", "details" (the <form>), "done" |
The three steps. Required. |
template[data-part="day"], "group", "slot" |
What a day, a part of the day and a time are made from. Required. |
data-days, data-slots |
Where days and times go. data-slots carries data-morning and data-afternoon. |
data-loading, data-picker, data-empty, data-empty-text, data-retry |
Shown while loading, when there are times, and when there are none or they can't be fetched. |
data-page="-1", data-page="1", data-month |
Earlier and later days, and the month shown. |
data-continue, data-back, data-submit, data-close, data-again |
Buttons. data-again starts a new booking after one is through. |
data-when, data-zone, data-duration, data-email, data-resource |
Filled with the chosen time, the name of the time zone shown, the length of a time, the email typed and the name of the resource (with resource-id). |
<select data-zone-select> |
Filled with the time zones to choose from. Optional: without it the times stay in the visitor's zone, or the one timezone names. |
data-status |
Errors, with the texts in data-taken and data-failed. |
| Form fields | Each in a <label> with a <small data-error>. name, email and phonenumber are the customer, notes goes on the booking, any other name is sent in custom_data. Any kind of field works (hidden, select, radio buttons, checkboxes), and a value or choice in your markup is where it starts. |
data-pending, data-payment, data-approval, data-confirmed |
Shown while the booking awaits the customer's confirmation, payment, the account's approval, and once it is confirmed. An element can carry several. |
data-pay |
A link that becomes Makeplans' payment page for the booking. |
data-by="link", data-by="code" |
Shown for that way of confirming. |
data-via="email", data-via="sms" |
Shown when Makeplans sent the code that way. data-email then holds the phone number for SMS. |
data-code, data-verify, data-code-error |
The code field, its button and its error. |
data-calendar |
A link that becomes the booking as a calendar file. |
data-steps |
An <ol> whose items get is-done and is-current. |
Anything but the required parts can be left out. With mode="popup" wrap the
steps in <dialog class="mb-host">.
<makeplans-times> with your own markup takes a <template> holding the link
each time is made from.
On the element, bubbling: makeplans-booking:open, :time (a time was
chosen) and :booked (the booking was made, not yet confirmed). On
document: makeplans-booking:confirmed, once the booking is confirmed (not
while it awaits payment or approval), with event.detail.serviceId and
resourceId. Use them for analytics. Also on document:
makeplans-booking:zone when the time zone shown changes, with
event.detail.timeZone.
makeplans-booking:client fires on document before the first request. A
listener can set event.detail.client to its own Makeplans client, for a
proxy or test data (demo/dummy.js does).
The script also gives the page Makeplans, the client the widget uses, for
your own requests to the public API:
var mp = new Makeplans('youraccount');
mp.slots(15, {from: new Date(), to: '2026-12-31'}).then(function(slots) { … });It is its own package, @makeplans/client, whose README documents it with
examples.
npm run build # dist/ from src/
npm test # builds, then tests the texts and the built file
No dependencies but the client. The elements are tested in a browser: open
test/widget.html after a build and read the list.
- The client for the public API is the package
@makeplans/client. The build takes it fromnode_modules/(or from its repository in the folder beside this one,../makeplans-js) and puts it in the widget's file. src/makeplans-booking.js,src/makeplans-times.js: the elements.src/themes.css: the themes, as variables only.src/times.css: the ready-made<makeplans-times>.src/templates/<name>.htmland<name>.css: a template's markup and layout, written with the theme variables. The build picks up every pair.src/texts.json: the texts, by language.{key}in a template is a text.demo/: one page per use case, on dummy data (demo/dummy.jslists the cases it can show).
The files in src/ share one scope and name each other's functions directly;
the build wraps them together.
- An account that confirms with a link has to say so (
verification="link"); the API does not tell a link from a code. - The ready-made widget has no panel mode (a form that unfolds in place).
- A template is markup and layout. One that picks a time differently (a month calendar, say) also needs its own code for drawing the days.
MIT. Copyright MakePlans AS.