> For the complete documentation index, see [llms.txt](https://vue-generators.gitbook.io/vue-generators/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vue-generators.gitbook.io/vue-generators/develop/component/schema.md).

# Schema

The schema contains the [fields](/vue-generators/develop/fields.md) of the form, optionally in groups.

## Examples

### Simple form without groups

This simple form will have a text input for Name and a numeric input for Age.

```javascript
{ 
    fields: [
        {
            type: "input",
            inputType: "text",
            label: "Name",
            model: "name"
        },
        {
            type: "input",
            inputType: "number",
            id: "current_age",
            label: "Age",
            model: "age"
        }
    ]
}
```

### Simple form with groups

This form will have two sections:

* A "User Details" section, with a text input for username and an email input
* A "Preferences" section, with a select input for color and a numeric input for timeout

Sections are currently output as `<fieldset>` elements, with a `<legend>`.

```javascript
{ 
    groups: [
        {
            legend: "User Details",
            fields: [
                {
                    type: "input",
                    inputType: "text",
                    label: "Username",
                    model: "username"
                },
                {
                    type: "input",
                    inputType: "email",
                    id: "email",
                    label: "Email Address",
                    model: "email"
                }
            ]
        },
        {
            legend: "Preferences",
            fields: [
                {
                    type: "select",
                    label: "Color",
                    model: "color",
                    values: [
                        "Red",
                        "Green",
                        "Blue"
                    ]
                },
                {
                    type: "input",
                    inputType: "number",
                    id: "timeout",
                    label: "Timeout in Seconds",
                    model: "timeout"
                }
            ]
        }
    ]
}
```

It is also possible to have a schema with some fields grouped and some ungrouped:

```javascript
{ 
    fields: [
        {
            type: "input",
            inputType: "text",
            label: "Name",
            model: "name"
        }
    ],
    groups: [
        {
            legend: "User Details",
            fields: [
                {
                    type: "input",
                    inputType: "number",
                    id: "current_age",
                    label: "Age",
                    model: "age"
                }
            ]
        }
    ]
}
```

This form would have a text input for Name, followed by a fieldset for "User Details", containing a numeric input for Age.

> **Note**: any ungrouped fields will be output first, followed by any groups.

[Available field types](/vue-generators/develop/fields.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://vue-generators.gitbook.io/vue-generators/develop/component/schema.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
