Skip to content

The Open Standard for Generative UI

9.4 KB
Raw Blame
{
  "component": {
    "component": "Stack",
    "props": {
      "children": [
        {
          "component": "TextContent",
          "props": {
            "text": "User Settings",
            "size": "large-heavy"
          }
        },
        {
          "component": "Tabs",
          "props": {
            "items": [
              {
                "component": "TabItem",
                "props": {
                  "value": "profile",
                  "trigger": "Profile",
                  "content": [
                    {
                      "component": "Card",
                      "props": {
                        "children": [
                          {
                            "component": "CardHeader",
                            "props": {
                              "title": "Profile",
                              "subtitle": "Update your personal information and avatar."
                            }
                          },
                          {
                            "component": "Form",
                            "props": {
                              "name": "profile_update",
                              "fields": [
                                {
                                  "component": "FormControl",
                                  "props": {
                                    "label": "Display name",
                                    "input": {
                                      "component": "Input",
                                      "props": {
                                        "name": "display_name",
                                        "placeholder": "e.g., Alex Johnson",
                                        "type": "text",
                                        "rules": ["required", "minLength:2", "maxLength:60"]
                                      }
                                    }
                                  }
                                },
                                {
                                  "component": "FormControl",
                                  "props": {
                                    "label": "Avatar URL",
                                    "input": {
                                      "component": "Input",
                                      "props": {
                                        "name": "avatar_url",
                                        "placeholder": "https://example.com/avatar.png",
                                        "type": "url",
                                        "rules": ["url"]
                                      }
                                    }
                                  }
                                }
                              ],
                              "buttons": {
                                "component": "Buttons",
                                "props": {
                                  "buttons": [
                                    {
                                      "component": "Button",
                                      "props": {
                                        "label": "Save changes",
                                        "action": "submit:profile_update",
                                        "variant": "primary"
                                      }
                                    },
                                    {
                                      "component": "Button",
                                      "props": {
                                        "label": "Reset",
                                        "action": "action:reset_profile_form",
                                        "variant": "secondary"
                                      }
                                    }
                                  ]
                                }
                              }
                            }
                          }
                        ],
                        "variant": "card"
                      }
                    }
                  ]
                }
              },
              {
                "component": "TabItem",
                "props": {
                  "value": "security",
                  "trigger": "Security",
                  "content": [
                    {
                      "component": "Card",
                      "props": {
                        "children": [
                          {
                            "component": "CardHeader",
                            "props": {
                              "title": "Security",
                              "subtitle": "Manage sign-in protection and account security."
                            }
                          },
                          {
                            "component": "SwitchGroup",
                            "props": {
                              "items": [
                                {
                                  "component": "SwitchItem",
                                  "props": {
                                    "label": "Two-factor authentication (2FA)",
                                    "description": "Require a verification code when signing in.",
                                    "name": "two_fa",
                                    "value": "enabled",
                                    "checked": false,
                                    "defaultChecked": true,
                                    "disabled": false
                                  }
                                }
                              ],
                              "variant": "sunk"
                            }
                          },
                          {
                            "component": "TextCallout",
                            "props": {
                              "variant": "info",
                              "title": "Tip",
                              "description": "After enabling 2FA, you may be asked to set up an authenticator app or backup codes."
                            }
                          }
                        ],
                        "variant": "card"
                      }
                    }
                  ]
                }
              },
              {
                "component": "TabItem",
                "props": {
                  "value": "notifications",
                  "trigger": "Notifications",
                  "content": [
                    {
                      "component": "Card",
                      "props": {
                        "children": [
                          {
                            "component": "CardHeader",
                            "props": {
                              "title": "Notifications",
                              "subtitle": "Choose what you want to be notified about."
                            }
                          },
                          {
                            "component": "SwitchGroup",
                            "props": {
                              "items": [
                                {
                                  "component": "SwitchItem",
                                  "props": {
                                    "label": "Email notifications",
                                    "description": "Receive updates and account messages by email.",
                                    "name": "notif_email",
                                    "value": "enabled",
                                    "checked": true,
                                    "defaultChecked": true,
                                    "disabled": false
                                  }
                                },
                                {
                                  "component": "SwitchItem",
                                  "props": {
                                    "label": "Product updates",
                                    "description": "Get notified about new features and improvements.",
                                    "name": "notif_product",
                                    "value": "enabled",
                                    "checked": false,
                                    "defaultChecked": false,
                                    "disabled": false
                                  }
                                },
                                {
                                  "component": "SwitchItem",
                                  "props": {
                                    "label": "Security alerts",
                                    "description": "Important alerts about sign-ins and security changes.",
                                    "name": "notif_security",
                                    "value": "enabled",
                                    "checked": true,
                                    "defaultChecked": true,
                                    "disabled": false
                                  }
                                }
                              ],
                              "variant": "sunk"
                            }
                          }
                        ],
                        "variant": "card"
                      }
                    }
                  ]
                }
              }
            ]
          }
        }
      ],
      "direction": "column",
      "gap": "l"
    }
  },
  "error": null
}