Guides and Sample Code

Developer

Apple TV Markup Language Reference

On This Page

alertTemplate

Use the alert template (alertTemplate) to display important information, such as a message telling the user to perform an action before continuing. At a minimum, provide a description of the alert and a button so the user can take any required actions. Figure 2-1 shows the basic layout for an alertTemplate page. The theme for the alert template defaults to the system preference.

Figure 2-1Alert template image: ../Art/ATV_temps_alert_2x.png

Main Elements of the Alert Template

Listing 2-1 shows the main elements in TVML format, and Table 2-1 provides element descriptions.

Listing 2-1alertTemplate TVML format
  1. <alertTemplate>
  2. <background>
  3. </background>
  4. <title>…</title>
  5. <description>…</description>
  6. <button>
  7. <text>…</text>
  8. </button>
  9. <text>…</text>
  10. </alertTemplate>

Table 2-1alertTemplate element descriptions

Element name

Description

background

Background elements, such as audio.

button

A button that typically allows the user to dismiss the alert or to bring up a new template page. The button element contains a text element that shows the name of the button.

description

The main text for the alert.

text

A brief description of what the button does.

title

The title of the alert, which should briefly communicate its purpose.

Alert Template Example

Listing 2-2 shows the TVML for an alertTemplate example. Figure 2-2 shows the output for the example.

Listing 2-2alertTemplate example TVML
  1. <document>
  2. <alertTemplate>
  3. <title>Update Available</title>
  4. <description>Get the latest tvOS version</description>
  5. <button>
  6. <text>Update Now</text>
  7. </button>
  8. <button>
  9. <text>Cancel</text>
  10. </button>
  11. </alertTemplate>
  12. </document>
Figure 2-2alertTemplate example output image: ../Art/alertTemplateSS_2x.png