Chauffeur Circle Docs

Widget

Frameworks

The widget is a standard web component, <chauffeur-circle-booking>, so it works in any framework. Load it once, then use the element.

<script async src="https://cdn.chauffeurcircle.com/v1/chauffeur-circle-widget.js"></script>
<chauffeur-circle-booking api-key="cc_pk_live_…" service="airport"></chauffeur-circle-booking>
Attribute Values
api-key Your publishable key (required)
mode inline, quote_box, popup
service point_to_point, airport, hourly
theme light, dark
label Popup button text

Listen for events such as chauffeur-circle:booked on the element.

React

import { useEffect, useRef } from 'react';

// Load https://cdn.chauffeurcircle.com/v1/chauffeur-circle-widget.js once, e.g. in index.html.
declare module 'react' {
  namespace JSX {
    interface IntrinsicElements {
      'chauffeur-circle-booking': { ref?: React.Ref<HTMLElement>; 'api-key': string; service?: string; mode?: string; theme?: string };
    }
  }
}

export function BookingForm() {
  const ref = useRef<HTMLElement>(null);

  useEffect(() => {
    const el = ref.current;
    const onBooked = (e: Event) => console.log('Booked', (e as CustomEvent).detail.reference);
    el?.addEventListener('chauffeur-circle:booked', onBooked);
    return () => el?.removeEventListener('chauffeur-circle:booked', onBooked);
  }, []);

  return <chauffeur-circle-booking ref={ref} api-key="cc_pk_live_…" service="airport" />;
}

React 19 passes attributes and events to custom elements directly; with React 18 use ref and addEventListener as above.

Next.js

The widget runs in the browser only. Put it in a client component and load the script with next/script:

'use client';
import Script from 'next/script';

export default function Book() {
  return (
    <>
      <Script src="https://cdn.chauffeurcircle.com/v1/chauffeur-circle-widget.js" strategy="afterInteractive" />
      <chauffeur-circle-booking api-key={process.env.NEXT_PUBLIC_CHAUFFEUR_CIRCLE_KEY!} />
    </>
  );
}

Add the JSX type declaration from the React example to a .d.ts file.

Vue

Tell Vue that chauffeur-circle- tags are custom elements:

// vite.config.ts
vue({ template: { compilerOptions: { isCustomElement: (tag) => tag.startsWith('chauffeur-circle-') } } })
<template>
  <chauffeur-circle-booking api-key="cc_pk_live_…" service="airport" @chauffeur-circle:booked="onBooked" />
</template>

<script setup lang="ts">
const onBooked = (e: CustomEvent) => console.log('Booked', e.detail.reference);
</script>

For Nuxt, set the same option under vue.compilerOptions.isCustomElement in nuxt.config.ts and wrap the element in <ClientOnly>.

Angular

Allow custom elements in the component (or module) that uses it:

import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';

@Component({
  selector: 'app-book',
  standalone: true,
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  template: `<chauffeur-circle-booking api-key="cc_pk_live_…" (chauffeur-circle:booked)="onBooked($event)"></chauffeur-circle-booking>`,
})
export class BookComponent {
  onBooked(e: Event) { console.log((e as CustomEvent).detail.reference); }
}

Add the script to index.html or to scripts in angular.json.

Laravel (Blade)

{{-- resources/views/book.blade.php --}}
<div id="book"></div>
<script async src="https://cdn.chauffeurcircle.com/v1/loader.js"
  data-key="{{ config('services.chauffeur_circle.key') }}"
  data-target="#book" data-mode="inline"></script>
// config/services.php
'chauffeur_circle' => ['key' => env('CHAUFFEUR_CIRCLE_PUBLISHABLE_KEY'), 'secret' => env('CHAUFFEUR_CIRCLE_SECRET_KEY')],

To list bookings on your server (Business plan), call the API with the secret key:

$bookings = Http::withToken(config('services.chauffeur_circle.secret'))
    ->get('https://api.chauffeurcircle.com/v1/bookings', ['status' => 'new'])
    ->json('data');

ASP.NET

In a Razor page or view:

<div id="book"></div>
<script async src="https://cdn.chauffeurcircle.com/v1/loader.js"
  data-key="@Configuration["ChauffeurCircle:PublishableKey"]"
  data-target="#book" data-mode="inline"></script>

Server side, with the secret key from configuration (never from the page):

var http = new HttpClient { BaseAddress = new Uri("https://api.chauffeurcircle.com/v1/") };
http.DefaultRequestHeaders.Authorization = new("Bearer", builder.Configuration["ChauffeurCircle:SecretKey"]);
var json = await http.GetStringAsync("bookings?status=new");

Plain HTML

Use the loader code from the dashboard. Nothing else is needed.