Field Component
A Field
component represents an input form field that supports validation rules and user guidance messages.
Example
{
"id": /* id object */,
"subset": "field",
"option": {
"validator": /* validator object or array of validator objects */
},
"content": {
"title": /* text object */,
"placeholder": /* text object */,
"message-error": /* text object or array of text objects */
}
}
🔑 Keys
id
- Object ID: A unique identifier used to reference this component locally or externally.
- Optional if the object is inline and not meant for reuse.
subset
- MANDATORY: Must be exactly
"field"
to define the component type. - MANDATORY if not resolved by another pointing reference (e.g., when the component is not coming from a resolved reference).
option
Validation options defining rules applied to the field input.
"option": {
"validator": /* validator object or array of validator objects */
}
validator
: A Validator object or an array of such objects defining validation rules.
Note: The id-message-error
key inside each validator object links to the corresponding error message defined in the component's content/message-error
array or object by matching the same ID.
📝 content
The content provides user-facing text such as titles, placeholders, and validation error messages.
"content": {
"title": /* string */,
"placeholder": /* string */,
"message-error": /* text object or array of text objects */
}
title
: A string representing the field label shown to the user. (Will evolve to use a Text object)placeholder
: A string displayed when the field is empty. (Will evolve to use a Text object)message-error
: Either a single or an array of Text objects representing validation error messages linked to the validators.