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

Create Data Adornments

Include data adornments in your Kizen apps for selectable icons next to Date, DateTime, and Phone Number fields, each with its own custom script.

Overview

Data adornments are graphical icons that appear next to Kizen fields of a particular type (see Figure 1). Selecting the adornment launches a custom script.

 A data adornment from an app enables the user to see the value of DateTime fields in New York time.
Figure 1: A data adornment from an app.

Kizen adds the adornment to all fields of its type throughout the user's business, although empty fields don't get the adornment. You also can't suppress the adornment on any field that has a value.

Any given app supports a single data adornment per field type. If your app attempts to add more than one adornment to the same type of field, the app's build fails. However, if multiple apps add adornments to the same type of field, Kizen displays an ellipsis next to these fields. Selecting the ellipsis opens a menu of all the field's active data adornments (see Figure 2).

The user opens a data adornment's ellipsis menu in an environment where two different apps add adornments to the same type of field.
Figure 2: The ellipsis menu for multiple data adornments.

Add a data adornment to your app

Add your data adornment to the dataAdornments directory in src. Place each adornment in its own subdirectory with config.json and script.js files, like this:

The following table describes these files:

File
Type
Purpose
Required?

config.json

JSON

The configuration file for the data adornment

Yes

script.js

JavaScript

The script that runs when the user selects the data adornment

Yes

Data adornments also support custom icons. Include a PNG or SVG file for the icon in the adornment's directory. If you don't supply a custom icon, you can configure the adornment to use any of Kizen's built-in icons.

See below for details on each of these files.

About config.json for data adornments

The configuration file for a data adornment sets the properties of the adornment:

Note: The configuration above includes sample values for icon, color, and customIconFile. In actual practice, Kizen defaults to the custom icon file when you specify one and ignores the values of icon and color. If this were a real configuration, you would use either icon and color or customIconFile but not all three together.

The keys are as follows:

Key
Description
Required?

icon

The name of the icon that appears as the data adornment. For the available icon names, see the coding reference. If you supply a custom icon, Kizen ignores the value of this key.

No

color

The color of the data adornment. If you supply a custom icon, Kizen ignores the value of this key.

No

tooltip

The text that appears when the user hovers over the data adornment.

No

customIconFile

The file name of the PNG or SVG file to use as the data adornment icon. Store this file at the same level of the directory structure as the config.json file.

No

field_type

The type of field to which to apply the data adornment:

  • date. Apply the data adornment to all Date fields in the user's business.

  • datetime. Apply the data adornment to all DateTime fields in the user's business.

  • phonenumber. Apply the data adornment to all Phone Number fields in the user's business.

No

when

A condition that determines when to show the data adornment on the screen. This condition applies to all fields of the specified type, not just to a particular field. For more information, see the coding reference.

No

About script.js for data adornments

The JavaScript file for a data adornment is the adornment's main script. Kizen runs the script when the user selects the adornment.

The script can use standard JavaScript, most web APIs available to Web Workers, and Kizen's runtime API. Because the script acts as the signed-in user, it can do whatever the user can do in Kizen, with the same permissions. It knows the user's name and currently active business. It also knows where the user selected the adornment by its associated field, record, and so on, all of which the script can read from properties of the this.args object. See the following table for details.

this.args property
Contains

entityId

The ID of the specific record

fieldId

The ID of the specific field

fieldType

The type of the field: date for the Date type, datetime for the DateTime type, and phonenumber for the Phone Number type

objectId

The ID of the record object

value

The value of the field

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

However, keep in mind these limitations:

  • A data adornment script has no DOM access. It can display toasts and modals, and it can navigate to other pages, but it can't directly edit the content in the browser window.

  • A data adornment script requires user interaction. It can't launch itself. For tasks that need to run automatically, use an agentic workflow code step instead.

  • A data adornment 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.


What's Next

Go to Create App Surfaces to explore the types of surfaces that you can include in your app.


Last updated

Was this helpful?