UI Elements BETA

UI Elements are JavaScript components that provide user interface overlays to various Cronofy API end points.

Installation #

All the UI Elements accept some global options, and each have additional Element-specific options. For all Elements, load them into your app by including the source .js file into your page.


Once you’ve included the js file in your project, you can initialize the desired Element using the corresponding method and passing in an options as an object. For example, to load the “Agenda” Element, your script would look like this:

CronofyElements.Agenda({ token: "YOUR_TOKEN", target: "cronofy-agenda" });

Initialize the Element #

const Element = CronofyElements.AvailabilityViewer({
    element_token: "ELEMENT_TOKEN",
    target_id: 'cronofy-availability-viewer',
    availability_query: {
        /* query options */
    config: {
        start_time: "09:00",
        end_time: "15:30",
        interval: 15
    callback: notification => console.log('callback', notification)

Updating options #

Should you need to update the options for any Element, you can reload them with the .update() method (this requires you to have saved your Element instance to a variable beforehand):

// Load Element:
const YourElement = CronofyElements.AvailabilityViewer(optionsObject);

// Update the Element with new options:

When updating, you do not need to redeclare all the options; you just need to add the ones you want to update. For instance, the AvailabilityViewer Element accepts several options, but when you’re updating the options, you only need to include the options that are changing.

In This Section