<!--
{
  "documentType" : "article",
  "framework" : "TVML",
  "identifier" : "/documentation/TVML/formtemplate",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "formTemplate"
}
-->

# formTemplate

Provides the ability to gather information from the user.

## Overview

Use the `formTemplate` element to gather information from the user; for example,
requiring a password to access your app. The banner area can contain an image and
a description of your product. The user enters text in the text field directly below
the banner using the automatically generated keyboard. Use the footer area to contain
any user interaction buttons. The following figure shows the basic layout for a `formTemplate`
page. The theme for the form template defaults to the system preference.

![Layout diagram showing a banner area containing an image and description at the top, a text field followed by a keyboard below, and a footer area at the bottom.](images/com.apple.TVML/formtemplate-1.png)

### Form Template

The following listing shows the main elements of the `formTemplate` element in TVML
format.

```xml
<formTemplate>
    <background>
        …
    </background>
    <banner>
        <img />
        <description>…</description>
    </banner>
    <textField>…</textField>
    <footer>…</footer>
</formTemplate>
```

#### Element Descriptions

- [background](/documentation/TVML/background): Only accepts `img` and `heroImg` elements in the background.
- [banner](/documentation/TVML/banner): Information displayed along the top of the screen that is typically
  used to provide instructions to the user.
- [description](/documentation/TVML/description): The text used to describe what the user needs to enter.
- [footer](/documentation/TVML/footer): Information displayed along the bottom of the screen, such as
  a Submit button for the user to commit the information entered in `textField`.
- [img](/documentation/TVML/img): An image of the product.
- [textField](/documentation/TVML/textfield): User input field.

### Example

The following listing shows the TVML for a `formTemplate` example. The interactive
keyboard is automatically created. The footer area contains a button that can submit
the user input. Modify your main JavaScript file to accept the user input from the
button. For more information on available JavaScript functions, see <doc://com.apple.documentation/documentation/tvmljs>.

```xml
<document>
    <formTemplate>
        <banner>
            <img src="path to images on your server/Car_Movie_800X400.png" width="800" height="400"/>
            <description>Enter email for access</description>
        </banner>
        <textField>tclark@example.com</textField>
        <footer>
            <button>
                <text>Submit</text>
            </button>
        </footer>
    </formTemplate>
</document>
```

The following figure shows the output for the above example:

![Screenshot showing a product image and a prompt for the user’s email address. A keyboard is displayed for email entry.](images/com.apple.TVML/formtemplate-2.png)

## Topics

### Valid TVML Attributes

[binding](/documentation/TVML/binding)

Associates information in a data item with an element.

[layoutDirection](/documentation/TVML/layoutdirection)

Specifies the direction in which text is displayed.

[prototype](/documentation/TVML/prototype)

Associates a data item type with an element.

[theme](/documentation/TVML/theme)

Sets the color scheme for an element.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)