# Generative UI: Dynamic values

> Format values, calculate results and validate inputs.

Source: <https://everruns.com/docs/reference/generative-ui/dynamic-values/>

Format values, calculate results and validate inputs.

[All categories](https://everruns.com/docs/reference/generative-ui/)[Layout](https://everruns.com/docs/reference/generative-ui/layout/)[Text](https://everruns.com/docs/reference/generative-ui/text/)[Inputs](https://everruns.com/docs/reference/generative-ui/inputs/)[Data](https://everruns.com/docs/reference/generative-ui/data/)[Dynamic values](https://everruns.com/docs/reference/generative-ui/dynamic-values/)[Media](https://everruns.com/docs/reference/generative-ui/media/)[Composites](https://everruns.com/docs/reference/generative-ui/composites/)[Feedback](https://everruns.com/docs/reference/generative-ui/feedback/)

Try the controls and expand **A2UI example** for source. Actions display their message and values locally; no account or agent run is needed. Use **Reset** to start again. External maps and media load only when you select their load button.

No examples match. Try another component name or category.

Dynamic values

## Function values: formatString, calc, series, formatCurrency

`Slider``Text``List``Chart`

A2UI example

Put this operation inside an `a2ui` Markdown fence. Try the controls above. Actions appear locally in the preview; in an editable chat they become messages.

```
{
  "version": "1.0",
  "createSurface": {
    "surfaceId": "example-24",
    "catalogId": "copilotkit/standard@1",
    "dataModel": {
      "seats": 4
    },
    "components": [
      {
        "id": "root",
        "component": "Column",
        "gap": 3,
        "children": [
          "s",
          "t",
          "l",
          "ch"
        ]
      },
      {
        "id": "s",
        "component": "Slider",
        "label": "Seats",
        "min": 1,
        "max": 20,
        "value": {
          "@path": "/seats"
        }
      },
      {
        "id": "t",
        "component": "Text",
        "text": {
          "@call": "formatString",
          "args": {
            "value": "${/seats} ${pluralize(value: /seats, one: 'seat', other: 'seats')} cost ${formatCurrency(value: calc(expression: 'seats * 12', seats: /seats), currency: 'EUR')} per month"
          }
        }
      },
      {
        "id": "l",
        "component": "List",
        "items": [
          {
            "label": "Per seat",
            "value": {
              "@call": "formatCurrency",
              "args": {
                "value": 12,
                "currency": "EUR",
                "decimals": 0
              }
            }
          },
          {
            "label": "Renews",
            "value": {
              "@call": "formatDate",
              "args": {
                "value": "2026-11-01",
                "format": "EEEE, MMM d, yyyy"
              }
            }
          },
          {
            "label": "Seats (bound)",
            "value": {
              "@call": "formatNumber",
              "args": {
                "value": {
                  "@path": "/seats"
                }
              }
            }
          }
        ]
      },
      {
        "id": "ch",
        "component": "Chart",
        "chartType": "bar",
        "title": "Cumulative cost (series over the slider)",
        "xKey": "month",
        "series": [
          {
            "key": "cost",
            "label": "Cost"
          }
        ],
        "data": {
          "@call": "series",
          "args": {
            "count": 6,
            "variable": "m",
            "item": {
              "month": "M${m}",
              "cost": "${m * seats * 12}"
            },
            "seats": {
              "@path": "/seats"
            }
          }
        },
        "height": 180
      }
    ]
  }
}
```

Dynamic values

## Checks: length, email; Button disabled until valid

`TextField``Button`

A2UI example

Put this operation inside an `a2ui` Markdown fence. Try the controls above. Actions appear locally in the preview; in an editable chat they become messages.

```
{
  "version": "1.0",
  "createSurface": {
    "surfaceId": "example-25",
    "catalogId": "copilotkit/standard@1",
    "dataModel": {
      "invite": {
        "name": "",
        "email": ""
      }
    },
    "components": [
      {
        "id": "root",
        "component": "Card",
        "children": [
          "ti",
          "n",
          "e",
          "b"
        ]
      },
      {
        "id": "ti",
        "component": "Title",
        "text": "Invite a teammate",
        "size": "sm"
      },
      {
        "id": "n",
        "component": "TextField",
        "label": "Name",
        "value": {
          "@path": "/invite/name"
        },
        "checks": [
          {
            "condition": {
              "@call": "length",
              "args": {
                "value": {
                  "@path": "/invite/name"
                },
                "min": 2
              }
            },
            "message": "At least 2 characters"
          }
        ]
      },
      {
        "id": "e",
        "component": "TextField",
        "label": "Email",
        "variant": "email",
        "value": {
          "@path": "/invite/email"
        },
        "checks": [
          {
            "condition": {
              "@call": "email",
              "args": {
                "value": {
                  "@path": "/invite/email"
                }
              }
            },
            "message": "Enter a valid email address"
          }
        ]
      },
      {
        "id": "b",
        "component": "Button",
        "label": "Send invite",
        "variant": "primary",
        "checks": [
          {
            "condition": {
              "@call": "and",
              "args": {
                "values": [
                  {
                    "@call": "length",
                    "args": {
                      "value": {
                        "@path": "/invite/name"
                      },
                      "min": 2
                    }
                  },
                  {
                    "@call": "email",
                    "args": {
                      "value": {
                        "@path": "/invite/email"
                      }
                    }
                  }
                ]
              }
            },
            "message": "Fill in a name and a valid email"
          }
        ],
        "onClick": {
          "event": {
            "name": "invite",
            "userMessage": {
              "@call": "formatString",
              "args": {
                "value": "Invite ${/invite/name} (${/invite/email})"
              }
            }
          }
        }
      }
    ]
  }
}
```

Using these components in chat? See [Generative UI in chat](https://everruns.com/docs/features/generative-ui/) and [AG-UI support](https://everruns.com/docs/integrations/ag-ui/).

Examples adapted from the [CopilotKit standard catalog](https://docs.copilotkit.ai/generative-ui/components/standard-catalog), under the [MIT license](https://github.com/everruns/everruns/blob/main/apps/ui/generative-ui/COPILOTKIT-LICENSE).