Skip to main content

Field

type OverlayField = {
key: string
type: OverlayFieldType
name: string
defaultValue?: string
options?: Record<string, string>
}

The OverlayField object contains the following properties:

Key

This is the query parameter name that will be used to pass the value of the field to the overlay. For example, if the key is foo, the overlay will receive the value of the field as ?foo=bar.

Type

type OverlayFieldType =
| 'string'
| 'percentage'
| 'degree'
| 'number'
| 'bool'
| 'color'
| 'date'
| 'time'
| 'option'

This is the type of the field. The following types are supported:

String

A string value.

Percentage

A number/int value between 0 and 100.

Degree

A number/int value between 0 and 360.

Number

A number/float value.

Bool

A bool/boolean value.

Color

A 8-digit hex color value in the format RRGGBBAA.

caution

This valud does not has a # prefix to prevent it from being interpreted as a fragment.

Date

A date value in the format yyyyMMdd.

Time

A time value in the format hhmmss.

Name

The name of the field.

Default value

The optional default value of the field. This is always a string value. The overlay explorer will convert the value to the correct type based on the type property.

Options

This is a optional object/Dictionary of options that can be used to provide a list of options for the field. The key is the value that will be passed to the overlay, and the value is the name of the option.

caution

This property is only used when the type is option.

Consider the following example:

{
'bar': 'Bar',
}

The overlay explorer will display a dropdown which has a option named Bar, with a value of bar.