Skip to main content
The vanilla JavaScript embed snippet is the lightest way to add Cal.com booking functionality to any website. It works with any tech stack and requires no build tools or dependencies.

Installation

Add the embed snippet to your HTML page. This is all you need to get started:
Replace https://app.cal.com with your Cal.com instance URL if you’re self-hosting.

Quick Start Examples

Inline Embed

Embed the calendar directly in your page:
Open the calendar in a modal when a button is clicked:

Floating Button

Add a persistent floating button to your page:

API Reference

Initialization

Always initialize Cal before using it:

Inline Method

Embed the calendar inline in a container:
Open the calendar in a modal programmatically:

Floating Button Method

Create a floating action button:

UI Method

Update UI configuration dynamically:

Configuration Options

The config object supports the following properties:

Prefill Fields

UI Configuration

Iframe Attributes

Event Handling

Listen to booking events to integrate with your application:

Listen to Events

Available Events

Remove Event Listeners

Using Namespaces

Namespaces allow multiple embeds on the same page without conflicts:

Performance Optimization

Prerendering

Preload the booking page for faster modal opening:

Preloading with Router

For routing forms, prerender with routing parameters:

Advanced Examples

Dynamic Configuration

Update configuration based on user actions:

Integration with Forms

Prefill booking data from a form:

Auto-forward Query Parameters

Forward URL query parameters to the embed:
Now parameters like ?name=John&email=john@example.com will be forwarded to the embed.

Element Click Embed

Use data attributes for zero-JavaScript modal embeds:

With Namespace

Debugging

Enable Logging

Add cal.embed.logging=1 to your page URL:
This will log:
  • Embed initialization
  • Parent-iframe communication
  • Event triggers
  • Configuration changes

Debug Mode

Enable debug mode during initialization:

Package Information

The embed snippet is part of the @calcom/embed-snippet package:
The snippet:
  • Loads @calcom/embed-core dynamically
  • Queues commands until the core library is ready
  • Supports multiple namespaces
  • Has zero dependencies
  • Minimal file size (~2KB)

Best Practices

Call Cal("init") once, preferably near the closing </body> tag. Multiple initializations are safe but unnecessary.
Ensure your elementOrSelector targets exist in the DOM before calling inline embed methods.
Set up event listeners with Cal("on", ...) before triggering actions that might fire those events.
For single-page applications, remove event listeners when unmounting components to prevent memory leaks.

Next Steps

Customization Options

Learn about themes, styles, and branding

React Component

Use the React wrapper for React apps