ResytechResytech Docs

Web Components

Drop-in UI components for building custom booking experiences with automatic theming from the Resytech API.

The Resytech client library includes a set of web components that render booking UI elements with Shadow DOM encapsulation. They automatically apply the operator's theme from the API and support CSS custom property overrides for full customization.

Setup

After initializing the API, call registerComponents() to define all custom elements and push the theme + activity data to them:

const api = new ResytechApi();
await api.initialization.initialize({ identifier: 'my-location' });
api.registerComponents();

Components are now available as HTML tags anywhere on the page.

Available Components

ComponentTagData SourceKey Event
Activity Card<resytech-activity-card>Init dataactivity-select
Activity List<resytech-activity-list>Init dataactivity-select
Equipment Card<resytech-equipment-card>JS propertyequipment-select
Equipment List<resytech-equipment-list>Init dataequipment-select
Duration Selector<resytech-duration-selector>JS propertyduration-select
Calendar<resytech-calendar>API calldate-select
Time Slots<resytech-timeslots>API calltimeslot-select
Add-on Selector<resytech-addon-selector>API calladdon-change
Cart Summary<resytech-cart-summary>JS property
Booking Embed<resytech-booking-embed>Iframecheckout-complete

Theming

All components inherit the operator's theme from the initialization response (checkoutSettings.activityPageTheme). The theme maps to CSS custom properties that you can override on any element or ancestor:

<resytech-activity-card
  activity-id="uuid"
  style="--resytech-primary: #e11d48; --resytech-border-radius: 8px;">
</resytech-activity-card>

CSS Custom Properties

PropertyDescriptionDefault
--resytech-primaryPrimary accent color#2563eb
--resytech-secondaryMuted text color#64748b
--resytech-accentAccent color (availability, highlights)#f59e0b
--resytech-card-bgCard background#ffffff
--resytech-card-textCard body text color#334155
--resytech-titleTitle text color#0f172a
--resytech-border-radiusCard corner radius12px
--resytech-card-shadowDefault card shadow0 1px 3px ...
--resytech-hover-shadowHover state shadow0 10px 15px ...
--resytech-header-bgImage placeholder / header background#f8fafc
--resytech-header-textHeader text color#0f172a
--resytech-font-familyFont familysystem-ui, -apple-system, sans-serif

Override at any level — individual element, a wrapper div, or :root for site-wide defaults:

/* Site-wide Resytech theme */
:root {
  --resytech-primary: #7c3aed;
  --resytech-border-radius: 16px;
  --resytech-font-family: 'Inter', sans-serif;
}

Events

Components emit CustomEvents that bubble through the DOM. Listen on the component itself or any ancestor:

document.addEventListener('activity-select', (e) => {
  console.log('Selected:', e.detail.activity.name);
});
EventFired ByDetail
activity-selectActivity Card, Activity List{ activity: InitializationActivity }
equipment-selectEquipment Card, Equipment List{ equipment: Equipment }
duration-selectDuration Selector{ duration: Duration }
date-selectCalendar{ date: string, day: ActivityCalendarDay }
timeslot-selectTime Slots{ slot: ActivityTimeSlot }
addon-changeAdd-on Selector{ selected: EligibleAddon[] }
checkout-readyBooking Embed{}
checkout-completeBooking Embed{ confirmationCode: string, price: number }
checkout-closeBooking Embed{}

Stored Init Data

After initialization, you can access the stored data at any time via convenience methods:

api.getOperator();          // Operator info
api.getActivities();        // Activity list
api.getCheckoutSettings();  // Checkout settings (includes theme)
api.getTheme();             // Activity page theme config
api.getInitResponse();      // Full initialization response

Next Steps

On this page