Data Types

List of supported types

Numeric type

lucky_number:
    type: numeric
    default: 5 # initial value to use on this field
    min: 1 # default: 0
    max: 9 # default: Decimal::MAX (79228162514264337593543950335)
    step: 1 # default: 1

String and multi-line string types

single_line_text: string

multi_line_text:
    type: string
    widget: text

Boolean type

yes_or_no: bool

Choice type

size:
    type: choice
    constraint: one # default: one | <one|optional|0..1|0..n>
    widget: radio
    options:
        - Small
        - Medium
        - Large
extras:
    type: choice
    constraint: 0..n
    widget: dropdown
    options:
        - Olives
        - Peach
        - Avocado

# Provides a searchable auto-complete style widget
continent:
    type: choice
    constraint: optional
    widget: search
    options:
        - Africa
        - Antarctica
        - Asia
        - Australia
        - Europe
        - North America
        - South America

Color types

color: rgb
# yields a hex color code in format: #aabbcc

color_with_alpha: rgba
# yields a color code in format: rgba(255, 255, 255, 0.5)

Date type

date_field: date
# yields a date value in ISO format: 2022-12-31

List type

mugs:
    type: list
    constraint: 0..n
    model: Mug # required
    add: true # default: true
    delete: true # default: true

Computed fields

volume:
    type: compute
    onchange:
        - height
        - diameter
    code: |
        fn compute_volume() {
            not_null(self.height);
            not_null(self.diameter);
            let r = to_float(self.diameter) * 0.5;
            return PI * r * r * to_float(self.height);
        }
  • Computed fields are automatically evaluated when any of the onchange fields are updated
  • The values are computed on the server side
  • See Compute Fields for more