String

Represents JS primitive type string.

{
    "type": "string"
}

Format

The format keyword allows for basic semantic validation on certain kinds of string values that are commonly used. This allows values to be constrained beyond what Regular Expressions can do.

Possible values:

date, email, hostname, uri, uri-reference, ipv4, ipv6, mac, date-time, time, egex, color, credit-card, phone.

{
  "$theme": "rounded/blue",
  "schema": {
    "type": "object",
    "properties": {
      "email": {
         "type": "string",
         "format": "email"
      }
    }
  },
  "layout": {
    "type": "div",
    "items": [{
        "key": "email"
    }]
  }
}

Minimum Length

The keyword for setting minimal length on string prop is minLength. The value of this keyword MUST be a non-negative integer.

A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword. The length of a string instance is defined as the number of its characters as defined by RFC 7159 [RFC7159].

Omitting this keyword has the same behavior as a value of 0.

{
"$theme": "rounded/blue",
  "schema": {
     "type": "object",
     "properties": {
        "example": {
           "type": "string",
           "minLength": "5"
       }
     }
  },
  "layout": {
    "type": "div",
    "items": [{
        "key": "example"
    }]
  }
}

Maximum Length

The keyword for setting maximal length on string prop is maxLength. The value of this keyword MUST be a non-negative integer.

A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword. The length of a string instance is defined as the number of its characters as defined by RFC 7159 [RFC7159].

{
"$theme": "rounded/blue",
  "schema": {
     "type": "object",
     "properties": {
        "example": {
           "type": "string",
           "maxLength": "5"
       }
     }
  },
  "layout": {
    "type": "div",
    "items": [{
        "key": "example"
    }]
  }
}

Pattern

The keyword for setting pattern is pattern.

The value of this keyword MUST be a string. This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect. A string instance is considered valid if the regular expression matches the instance successfully. Recall: regular expressions are not implicitly anchored.

{
"$theme": "rounded/blue",
  "schema": {
     "type": "object",
     "properties": {
        "example": {
           "type": "string",
           "pattern": "[A-Z][1-9][a-z]"
       }
     }
  },
  "layout": {
    "type": "div",
    "items": [{
        "key": "example"
    }]
  }
}

Secret

The keyword for setting secret is secret.

The value of this keyword MUST be a boolean - true or false.

{
"$theme": "rounded/blue",
  "schema": {
     "type": "object",
     "properties": {
        "example": {
           "type": "string",
           "secret": true
       }
     }
  },
  "layout": {
    "type": "div",
    "items": [{
        "key": "example"
    }]
  }
}

Multiline

The keyword for setting multiline is multiline.

The value of this keyword can be either boolean or number. Number value controls quantity of rows to be displayed.

{
"$theme": "rounded/blue",
  "schema": {
     "type": "object",
     "properties": {
        "example": {
           "type": "string",
           "multiline": 6
       }
     }
  },
  "layout": {
    "type": "div",
    "items": [{
        "key": "example"
    }]
  }
}

Last updated

Was this helpful?