Skip to content

About

EasyWeek online booking widget for React and Next.js: a floating Book now button, booking buttons for services and an embedded booking form. One typed component, no dependencies.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

EasyWeek booking widget for React and Next.js

Add online appointment booking to a React or Next.js site with the EasyWeek booking widget: a floating "Book now" button, a "Book" button next to every service, a booking form inside a page, or a full booking page. One file, no dependencies besides React, typed for TypeScript.

Quick start

  1. Copy components/easyweek.tsx into your project.
  2. Wrap your app or root layout once:
import { EasyWeekProvider } from './components/easyweek'

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        <EasyWeekProvider
          url="https://booking.easyweek.io/your-company"
          button={{ text: 'Book now', showText: true }}
        >
          {children}
        </EasyWeekProvider>
      </body>
    </html>
  )
}

A round "Book now" button appears in the corner of every page. A click opens the booking form on top of the page, and the client books without leaving your site.

Replace your-company with your own booking link: it is in your EasyWeek account under Integrations and Apps › Booking Widget. The component loads widget.js from the host of that link, once per page.

Open booking from your own buttons

'use client'

import { useEasyWeek } from './components/easyweek'

export function BookButton() {
  const easyweek = useEasyWeek()

  return <button onClick={() => easyweek.open()}>Book online</button>
}

export function ServiceButton({ serviceId, locationId }) {
  const easyweek = useEasyWeek()

  return <button onClick={() => easyweek.openService(serviceId, locationId)}>Book</button>
}

Leave out button on the provider when you only want your own buttons.

Method Opens
open() / close() The booking form
openStart() The start page of your company
openLocation(locationId) One location
openService(serviceId, locationId, staffId?) One service, optionally with a specialist
openSpecialist(staffId, locationId) One specialist
openGiftCard(giftCardId, locationId) One gift card
openMembership(membershipId, locationId) One membership

The ids stand in the address of the page in your booking form, for example https://booking.easyweek.io/your-company/{locationId}/{serviceId}. A call made before the widget has loaded waits and runs when it is ready.

Booking form inside a page

import { EasyWeekEmbed } from './components/easyweek'

<EasyWeekEmbed url="https://booking.easyweek.io/your-company" title="Online booking" />

A separate booking page that fills the screen:

<EasyWeekEmbed url="https://booking.easyweek.io/your-company" title="Online booking" fullPage />

url can point deeper: a location, a service or a specialist. title is the accessible name of the frame, in the language of your page.

Options of the provider

Prop What it does
url Your booking link, required
button The floating button: text, showText, position ('left' or 'right'), background, color, textColor, textBackground. Leave it out for no floating button
colors Your palette for the booking form: primary, onPrimary, surface, onSurface, background, all five as #rrggbb
trigger A CSS selector of your own elements that open the form
logo, logoBackground The loading screen
<EasyWeekProvider
  url="https://booking.easyweek.io/your-company"
  button={{ text: 'Book now', showText: true, background: '#168aad' }}
  colors={{
    primary: '#168aad',
    onPrimary: '#ffffff',
    surface: '#ffffff',
    onSurface: '#222222',
    background: '#f1f8dc'
  }}
>

How it works

  • EasyWeekProvider loads widget.js once, creates the widget after mount and destroys it on unmount. React Strict Mode and route changes leave exactly one button on the page.
  • Everything runs in the browser only ('use client'), so server rendering in Next.js works as usual.
  • EasyWeekEmbed loads the same script next to the frame: it takes the client to the payment page or to your thank-you page when the form asks for it.

Run the example

npm install
npm run dev

Open http://localhost:3000. The example uses the EasyWeek demo company; put your own link into app/booking-config.ts.

Page Shows
app/page.tsx Floating button from the layout and a "Book" button for every service
app/embed/page.tsx The booking form inside a page
app/booking/page.tsx A full booking page

Install it with an AI assistant

Coding agents in Claude Code, Cursor, Codex and GitHub Copilot read AGENTS.md. You can also ask your assistant:

Add EasyWeek online booking to this React app. Copy components/easyweek.tsx from
https://github.com/easyweek/booking-widget-react into the project, wrap the root layout in
<EasyWeekProvider url="https://booking.easyweek.io/your-company" button={{ text: 'Book now', showText: true }}>
and check that one "Book now" button shows on every page and opens the booking form.

About EasyWeek

EasyWeek is online booking and business management software for service businesses: beauty salons, barbershops, clinics, fitness and yoga studios, schools and rentals. More than 50,000 users run their bookings, clients, payments and reminders in it. Online booking is part of every plan, the free one included. All features: github.com/easyweek and easyweek.io/business/features.

More from EasyWeek on GitHub

License

MIT. EasyWeek is a registered trademark of EasyWeek GmbH.

About

EasyWeek online booking widget for React and Next.js: a floating Book now button, booking buttons for services and an embedded booking form. One typed component, no dependencies.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages