🌊
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
  • Dynamic array
  • Fixed array
  • Options
  • Displaying in layout

Was this helpful?

Export as PDF
  1. Schema
  2. Prop types

Array

Represents JavaScript array.

Dynamic array

{
    "type": "array",
    "items": { ... }
}

Fixed array

{
    "type": "array",
    "items": [{ ... }, { ... }]
}

Prop can be defined as dynamic array

      {
           "type": "array",
           "items": {
              "type": "string"
           }
       }

In this case above would be TS type string[].

... or as fixed

      {
           "type": "array",
           "items": [
                   {"type": "string" },  {"type": "number" }, {"type": "string" }
           ]
       }

In this case above would be TS type [string, number, string].

Options

uniqueItems

The value of this keyword MUST be a boolean. If this keyword has boolean value false, the instance validates successfully. If it has boolean value true, the instance validates successfully if all of its elements are unique. Omitting this keyword has the same behavior as a value of false.

minItems

The value of this keyword MUST be a non-negative integer. An array instance is valid against "minItems" if its size is greater than, or equal to, the value of this keyword. Omitting this keyword has the same behavior as a value of 0.

maxItems

The value of this keyword MUST be a non-negative integer. An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword.

Displaying in layout

How to loop

Crucial layout part in order to be able to loop over array items is LayoutPropArray. You specify `key` to the array prop. Anything inside `items` will automatically be repeated for each element in array prop.

{
        "type": "array",
        "key": "planets",
        "items": [  { "key": "planets[]" }   ]
}
PreviousObjectNextDate

Last updated 4 years ago

Was this helpful?