🌊
jsf
  • About KalmiaJSF
  • Setup
  • Architecture
  • Contributing
  • Changelog
  • Guides
    • Cheat Sheet
  • Examples
    • Demo example
    • Basic examples
    • Kitchen Sink example
    • Charts example
  • Schema
    • Intro to Schema
    • Prop types
      • String
      • Boolean
      • Number & Integer
      • Object
      • Array
      • Date
      • Id
      • Null
      • Ref
      • Binary
    • Prop options
      • Disabling property
      • On prop init actions
      • Persist
      • On value change
      • On user value change
    • Handlers
      • Color picker
    • Creating custom handler
      • Working with arrays
    • Value provider
  • Validation
    • Custom validation
    • Eval
  • LAYOUT
    • Intro to Layout
    • Layout options
      • Show & hide
      • On click action
  • INTERFACES
    • Value Options
  • Form
    • Form data
  • OTHER
    • Events
    • Lifecycle hooks
    • Notifications support
  • PAGES & COMPONENTS
    • Page
    • Component
  • THEMING
    • Creating new theme variant
  • BUILDER
    • Shortcuts
  • Help
    • FAQ
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Schema
  2. Prop types

String

PreviousProp typesNextBoolean

Last updated 4 years ago

Was this helpful?

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 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"
    }]
  }
}
Regular Expressions