Skip to content

The Open Standard for Generative UI

4.9 KB
Raw Blame
{
  "component": {
    "component": "Stack",
    "props": {
      "children": [
        {
          "component": "TextContent",
          "props": {
            "text": "Contact Us",
            "size": "large-heavy"
          }
        },
        {
          "component": "Form",
          "props": {
            "name": "contact",
            "fields": [
              {
                "component": "FormControl",
                "props": {
                  "label": "Name",
                  "input": {
                    "component": "Input",
                    "props": {
                      "name": "name",
                      "placeholder": "Your full name",
                      "type": "text",
                      "rules": ["required", "minLength:2"]
                    }
                  }
                }
              },
              {
                "component": "FormControl",
                "props": {
                  "label": "Email",
                  "input": {
                    "component": "Input",
                    "props": {
                      "name": "email",
                      "placeholder": "[email protected]",
                      "type": "email",
                      "rules": ["required", "email"]
                    }
                  }
                }
              },
              {
                "component": "FormControl",
                "props": {
                  "label": "Phone",
                  "input": {
                    "component": "Input",
                    "props": {
                      "name": "phone",
                      "placeholder": "e.g., +1 555 123 4567",
                      "type": "text",
                      "rules": ["required", "minLength:7", "maxLength:20"]
                    }
                  }
                }
              },
              {
                "component": "FormControl",
                "props": {
                  "label": "Subject",
                  "input": {
                    "component": "Select",
                    "props": {
                      "name": "subject",
                      "items": [
                        {
                          "component": "SelectItem",
                          "props": {
                            "value": "general",
                            "label": "General inquiry"
                          }
                        },
                        {
                          "component": "SelectItem",
                          "props": {
                            "value": "support",
                            "label": "Support"
                          }
                        },
                        {
                          "component": "SelectItem",
                          "props": {
                            "value": "sales",
                            "label": "Sales"
                          }
                        },
                        {
                          "component": "SelectItem",
                          "props": {
                            "value": "billing",
                            "label": "Billing"
                          }
                        },
                        {
                          "component": "SelectItem",
                          "props": {
                            "value": "feedback",
                            "label": "Feedback"
                          }
                        }
                      ],
                      "placeholder": "Select a subject...",
                      "rules": ["required"]
                    }
                  }
                }
              },
              {
                "component": "FormControl",
                "props": {
                  "label": "Message",
                  "input": {
                    "component": "TextArea",
                    "props": {
                      "name": "message",
                      "placeholder": "How can we help?",
                      "rows": 6,
                      "rules": ["required", "minLength:10"]
                    }
                  }
                }
              }
            ],
            "buttons": {
              "component": "Buttons",
              "props": {
                "buttons": [
                  {
                    "component": "Button",
                    "props": {
                      "label": "Submit",
                      "action": "submit:contact",
                      "variant": "primary"
                    }
                  },
                  {
                    "component": "Button",
                    "props": {
                      "label": "Cancel",
                      "action": "action:cancel_contact",
                      "variant": "secondary"
                    }
                  }
                ],
                "direction": "row"
              }
            }
          }
        }
      ],
      "direction": "column",
      "gap": "l"
    }
  },
  "error": null
}