🌊
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
  • Empty string prop
  • String prop with placeholder
  • Required string prop
  • Disabled and constant string prop
  • Limited/specific format string prop
  • Number input examples

Was this helpful?

Export as PDF
  1. Examples

Basic examples

Empty string prop

{
  "schema": {
    "type": "object",
    "properties": {
      "firstName": {
        "type": "string"
      }
    }
  },
  "layout": {
    "key": "firstName"
  }
}

String prop with placeholder

{
  "schema": {
    "type": "object",
    "properties": {
      "firstName": {
        "description": "Enter your first name",
        "title": "First name",
        "type": "string"
      }
    }
  },
  "layout": {
    "key": "firstName",
    "placeholder": "Example: John"
  }
}

Required string prop

{
  "schema": {
    "type": "object",
    "properties": {
      "firstName": {
        "type": "string",
        "title": "I mustn't be empty!",
        "description": "Textbox that cannot be empty",
        "required": true
      }
    }
  },
  "layout": {
    "key": "firstName",
    "placeholder": "Example: John"
  }
}

Disabled and constant string prop

{
  "schema": {
    "type": "object",
    "properties": {
      "disabledTextbox": {
        "type": "string",
        "enabledIf": "return false",
        "title": "I'm disabled"
      },
      "constExample": {
        "title": "Constant textbox",
        "type": "string",
        "const": "This textbox has constant value"
      }
    }
  },
  "layout": {
    "type": "div",
    "items": [
      {
        "key": "disabledTextbox"
      },
      {
        "key": "constExample"
      }
    ]
  }
}

Limited/specific format string prop

{
  "schema": {
    "type": "object",
    "properties": {
      "limitedTextbox": {
        "type": "string",
        "maxLength": 7,
        "minLength": 3
      },
      "emailFormat": {
        "type": "string",
        "format": "email",
        "title": "Email"
      }
    }
  },
  "layout": {
    "type": "div",
    "items": [
      {
        "key": "limitedTextbox",
        "placeholder": "Limited text box"
      },
      {
        "type": "hr"
      },
      {
        "key": "emailFormat"
      },
      {
        "type": "hr"
      },
      {
        "htmlClass": "text-center",
        "type": "heading",
        "title": "There are more formats than just one available for string type!",
        "level": 5
      },
      {
        "type": "span",
        "title": "Available formats: email, hostname, uri, uri-reference, ipv4, ipv6, mac, date-time, date, time, regex, color, credit-card, phone"
      }
    ]
  }
}

Number input examples

{
  "schema": {
    "type": "object",
    "properties": {
      "normalNumberInput": {
        "type": "integer",
        "title": "Number input"
      },
      "minMaxNumberInput": {
        "type": "integer",
        "title": "Min/Max number input",
        "minimum": 0,
        "maximum": 1000,
        "required": true
      },
      "disabledNumberInput": {
        "type": "integer",
        "title": "Disabled number input box",
        "enabledIf": "return false"
      }
    }
  },
  "layout": {
    "type": "div",
    "items": [
      {
        "placeholder": "312",
        "key": "normalNumberInput"
      },
      {
        "key": "minMaxNumberInput"
      },
      {
        "key": "disabledNumberInput"
      }
    ]
  }
}
PreviousDemo exampleNextKitchen Sink example

Last updated 4 years ago

Was this helpful?