For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create Floating Frames

Include floating frames in your Kizen app to display interactive content that persists from page to page.

Overview

Floating frames are expandable and collapsible overlays that appear above Kizen in the browser window (see Figure 1). They contain either custom HTML or embedded pages from elsewhere on the web. They load in their expanded state, although you can control this behavior through code, and they persist from page to page, so they are ideal for dialers, media players, and chat clients. They can also react to events as they happen. A frame that embeds a phone system, for example, can open a caller's contact record when the call starts and log the call as an activity when it ends.

Two floating frames -- one called Clock, and one called Developer Docs -- appear as overlays on the Contacts page in Kizen.
Figure 1: Floating frames from an app.

Note: Kizen shows floating frames on all pages except for the login page, personal settings pages, embedded views, and builder pages, and generally hides them when modals are open, unless the frame was open before the modal. On all other pages, you can specify on which Kizen pages to show or hide a particular floating frame with the match and ignore configuration settings. For details, see About config.json for floating frames below.


Add a floating frame to your app

Add your floating frames to the floatingFrames directory in src. Place each floating frame in its own subdirectory with config.json, script.js, styles.css , and message.js files as needed, like this:

Note: Depending on the floating frame, you might not need one or more of the files.

The following table describes these files:

File
Type
Purpose
Required?

config.json

JSON

The configuration file for the floating frame.

Yes

script.js

JavaScript

The script that runs when Kizen loads the floating frame.

Yes

styles.css

Cascading Style Sheet

The styles for the content inside the floating frame. If the frame embeds content from an outside source, you don't need this file.

No

message.js

JavaScript

A cross-document message handler. If the page in your frame doesn't send cross-document messages, you don't need this file.

No

Floating frames also support event scripts. Place event scripts in the frame's eventScripts subdirectory. For more information on event scripts, see the coding reference.

See below for details on each of these files.

About config.json for floating frames

The configuration file for a floating frame sets the properties of the frame:

Note: You might also find references to the html key for floating frames, but Kizen doesn't use its content. You can ignore this key.

The keys are as follows:

Key
Description
Required?

name

The internal name of the floating frame.

Yes

api_name

The API name of the floating frame in all lowercase letters. If you don't specify a value for this key, the system automatically generates one based on the name of the floating frame's subdirectory.

No

title

The title of the floating frame. The title appears in the frame's title bar.

Yes

default_position

The default position of the floating frame:

  • bottom-left. The floating frame appears in the bottom left corner of the browser window to start.

  • bottom-left-fixed. The floating frame is pinned to the bottom left corner of the browser window.

  • bottom-right. The floating frame appears in the bottom right corner of the browser window to start.

  • bottom-right-fixed. The floating frame is pinned to the bottom right corner of the browser window.

No

header_color

The background color of the title bar. Set the value to a hexadecimal color code, CSS color, or color keyword.

No

header_text_color

The color of the text in the title bar. Set the value to a hexadecimal color code, CSS color, or color keyword.

No

height

The height of the floating frame in pixels.

No

width

The width of the floating frame in pixels.

No

ignore

A list of regular expressions that describe on which page paths to hide the floating frame. Kizen always hides floating frames on the login page, personal settings pages, embedded views, and builder pages.

No

match

A list of regular expressions that describe on which page paths to show the floating frame. Kizen never shows floating frames on the login page, personal settings pages, embedded views, and builder pages.

No

minimized_style

The appearance of the collapsed floating frame:

  • circle. The floating frame appears as an icon in a circle in the bottom left or right corner of the browser window, depending on the position of the frame. The user selects the circle to expand and collapse the frame. You must use this style with a fixed-position floating frame.

  • bar. The floating frame appears as its title bar only. The user selects the bar to expand and collapse the frame.

  • none. The floating frame disappears from the screen. The user can't interact with it directly, but it remains expandable and collapsible through code.

No

minimized_config

An object that describes the collapsed floating frame when the minimized style is circle. These keys have no effect when the minimized style is bar or none.

No

minimized_config.icon

The name of the icon that appears in the floating frame's circle. For the available icons, see the coding reference.

No

minimized_config.color

The color of the floating frame's circle. Set the value to a hexadecimal color code, CSS color, or color keyword.

No

when

A condition that determines when to show the floating frame on the screen. For more information, see the coding reference.

No

Note: Floating frames don't have a key to control their starting state, but you can write logic to achieve the same effect. To collapse a frame on load, call this.collapse() from its script. To expand a collapsed frame, call this.expand().

About script.js for floating frames

The JavaScript file for a floating frame is the main script for the frame. Kizen runs the script when the frame loads. The script sets the starting state of the frame.

The script can use standard JavaScript, most web APIs available to Web Workers, and Kizen's runtime API, including methods for controlling the frame. Because the script acts as the signed-in user, it can do whatever the user can do in Kizen, with the same permissions, and it knows their name and currently active business. However:

  • A floating frame script doesn't keep track of which record the user is viewing. However, it can get the user's URL and determine the current record from that, and it can receive a notification when the user's URL changes to react to record pages.

  • A floating frame script controls only its own frame. It can show toasts and modals and navigate to other pages in Kizen, but it can't otherwise change the browser window outside the frame.

  • A floating frame script runs only while Kizen is open. Closing Kizen stops the script. For tasks that need to run on their own, use an agentic workflow code step instead.

  • A floating frame script starts fresh on each run. To carry values from previous runs, store them in the user's configuration or as short-term session data. For details, see the coding reference.

  • A floating frame script must finish before the user can interact with the frame. Code that runs on a loop or long delay, like a clock that updates its output every minute, belongs in an event script.

To paint content into the frame, use one of two methods. Use this.outputUI() for custom HTML and CSS:

Note: The data-script attributes in this example indicate the event scripts to run when the user interacts with the HTML elements in the floating frame. For more information on data-script, see the coding reference.

The method takes a single HTML string as its argument. The CSS comes from the frame's styles.css file or from inline style attributes in the HTML. For security, Kizen strips out <script> tags, event handlers, and javascript: links but leaves SVG, images, and <iframe> elements. For more information, see the coding reference.

To embed a live web page, use this.outputIframe():

Note: Another way to embed a page in a floating frame is to write an <iframe> element into your custom HTML with this.outputUI().

The page loads from its own server and runs its own code, so it can update itself. The address must start with https://, and the site must allow embedding. For more information, see the coding reference.

Note: Kizen loads embedded web pages through a frame proxy at https://plugin-assets.kizen.com. If you need to update your site to make it embeddable in Kizen, allow the proxy's domain, not just Kizen's. For more information on the frame proxy, see the coding reference.

About styles.css for floating frames

The style sheet for a floating frame provides the style definitions for the classes in the frame's custom HTML:

You don't need a style sheet if your frame uses this.outputIframe() to embed a live web page.

Note: Custom HTML content can inherit styling from Kizen before your style sheet applies. Therefore, for best results, explicitly set style properties for your classes instead of relying on default settings.

About message.js for floating frames

The message.js file for a floating frame is a script that runs when Kizen's browser window receives a cross-document message on a page with the frame. Cross-document messages usually come from the page embedded in the frame, but not necessarily. Any message that Kizen receives, except for Kizen's own messages to itself and messages about Kizen payments, triggers the frame's message.js script.

The message itself is in this.args.eventData. Check that the message you receive is the one you expect, and direct its handling logic to an event script with this.communicate.runFrameScript(), like this:

Note: For more information on the this.args object, see the coding reference.

To reply to the embedded page, use this.communicate.sendMessageToOwnFrame().

Note: If the embedded page in the floating frame navigates to another site, messaging stops until the frame repaints.


What's next?

Continue to Create Pages to learn how to include pages in your app.


Last updated

Was this helpful?