Skip to main content

Text

Text is a basic input for textual information.

💡 Common text usage

The text input type can be used to store any text based data, for example:

  • Image tags
  • Variable keys
  • Commit SHA
  • File names

In the live demo self-service hub page, we can see the scaffold new service action whose Service Name input is a text input. 🎬

API definition

{
"myTextInput": {
"title": "My text input",
"icon": "My icon",
"description": "My text input",
"type": "string",
"default": "My default"
}
}

Check out Port's API reference to learn more.

Terraform definition

resource "port_action" "myAction" {
# ...action properties
user_properties = {
string_props = {
myTextInput = {
title = "My text input"
description = "My text input"
default = "My default"
}
}
}
}

Validate text

Text validations support the following operators:

  • minLength - enforce minimal string length;
  • maxLength - enforce maximal string length;
  • pattern - enforce Regex patterns.
{
"myTextInput": {
"title": "My text input",
"icon": "My icon",
"description": "My text input",
"type": "string",
"minLength": 1,
"maxLength": 32,
"pattern": "^[a-zA-Z0-9-]*-service$"
}
}