APL Cheat Sheets
Use the Alexa Presentation Language (APL) cheat sheets to improve your APL development productivity. APL cheat sheets are a quick reference guide that provides information about the syntax and semantics of an APL document and its components, commands, and properties in a concise and easy-to-digest format.
Prerequisites
To use APL cheat sheets during APL development, you should already be familiar with the basic concepts and structure of an APL document. Otherwise, if you’re new to APL, start with Add Visuals and Audio to Your Skill in the Get Started section of this APL documentation.
Download the cheat sheet for APL 2024.1
To use the cheat sheets, download them first. APL cheat sheets come as printable PDF documents. You can either print them out to have them handy at your desk or you can use the PDFs on your computer. With printouts, you can easily look up information during development without switching between screens or windows.
To download, view, and print out the APL cheat sheets
- Click the following image.
APL cheat sheets version 2024.1, last updated March 21, 2024.
How do I use the APL cheat sheets?
To get the most out of APL cheat sheets, familiarize yourself with their structure, format, and symbols.
Structure
The APL cheat sheets PDF document has four pages. Each page has a title at its top to indicate what information you can find on it:
- Page 1: Document and Data Context – Provides the most relevant information about the APL document and its initial data context, resources, styles, commands, layout definitions, environment and viewport variables, as well as functions and data types that are available to the APL components and commands contained in your document.
- Page 2: Components – Contains information about APL components, and their properties and event handlers.
- Page 3: Components and AVG – Extends page 2 with information about APL components. Also, it provides details about how to define Alexa Vector Graphics (AVG) in your APL document.
- Page 4: Commands – Shares information about APL commands and their properties, event objects, and the component selector syntax.
Sections and their numbering
Every page is split up into sections. Each section represents an individual APL concept, or an APL element such as a component or command. If a section title is surrounded by curly brackets ({}), it indicates that the element is a JSON object in an APL document. For example, the following image shows section C.16 on page 3, which lists the properties of the VectorGraphic
component in APL.
In the cheat sheets, each section is identified by a letter and at least one number. For example, the section that contains information about the VectorGraphic
component has C.16 as its identifier. These identifiers are used in the cheat sheets for sections to reference each other. For example, the section C.16 defines the onLoad
event property of a VectorGraphic
component as an array of APL command objects that are further described in their own section, E.1. Moreover, this component is also characterized as being a touchable component that is further described in its dedicated section, C.3.
Property definitions
The main purpose of APL cheat sheets is to describe the JSON-based schema of APL components and commands to help you craft compliant and functional APL JSON documents. Each element in an APL document has a set of well-defined properties with a name and a value assignment. APL cheat sheets distinguish between regular value properties and event properties by listing them separately and with different background colors. Event properties, also known as event handlers, display with a light-blue background color at the bottom of the property definition table for the component. For example, the VectorGraphic
component brings two of its own event handlers, onFail
and onLoad
.
Component property definitions consistently use the same symbols, format, and syntax to describe more about their values and behaviors. The following line shows the pattern that the definitions follow.
{ ◻︎ | ◼︎ | ▲ | △ | ► | ▷ } Property-Name [ : Value-Type ] [ = Value | Value-Set ]
Symbols
The definition always starts with a symbol { ◻︎ | ◼︎ | ▲ | △ | ► | ▷ } , which signifies certain relevant attributes of a property. At the top of each cheat sheet page there is a legend that describes the meaning of each symbol.
For value properties, the following symbols apply:
- ◼︎ Filled square) – the property is dynamic. Dynamic properties can be assigned with dynamic value expressions and they can also be reassigned with the SetValue command.
- △ (Empty triangle) – the property is styled. Styled properties can be added to an APL style definition. As such, their value can change based on the component state. For details about styled properties, see APL Styled Properties.
- ▲ (Filled triangle) – the property is both dynamic and styled.
- ◻︎ (Empty square) – the property is neither styled nor dynamic. In other words, it's static. Assigned values are only evaluated one time, at the time that an APL document inflates.
For event properties, also called event handlers, the following symbols apply:
- ► (Filled triangular play symbol) – indicates that inside the event handler, APL commands, by default, run in normal mode. For details about normal mode, see Normal mode under APL Commands.
- ▷ (Empty triangular play symbol) – indicates that inside the event handler, APL commands, by default, run in fast mode. For details about fast mode, see Fast mode under APL Commands.
Property name
The symbol is followed by the name of a property. If the property name is underlined, you must assign it a value.
Value type
If the property expects a value of a particular type, such as String
or Array
, the type displays after the property name.
Value or value set
Some properties accept a single value or a value from a specified set of values. In such cases, the property definition lists the value or set of values to choose from. If there are multiple values to choose from, there usually is a default value that is automatically assigned, if you don’t assign your own value. The default value in a value set is underlined.
The following list shows some examples of property definitions of the VectorGraphic
component in section C.16 of page 3, as shown in the subsequent image:
- The
type
property is a mandatory property that always needs to be set to the string “VectorGraphic”. The blank square symbol (◻︎) tells you that this property is static. This means it is neither dynamic nor styled. - As indicated by the filled square ( ◼︎ ), the
source
property is dynamic but not styled. Its value is expected to be a string or a URL string. It doesn't have a default value. - The filled triangle ( ▲ ) symbol of the
scale
property says it is dynamic and styled. Its value is expected to be a string with one of the listed values: “none“, “fill“, “best-fill“ or “best-fit“. If unset, this property’s default value is set to ”none“. - The
onLoad
event property takes in an array of APL command objects, which are further described in their own section, E.1. Within this event handler, APL commands, by default, run in fast mode. Fast mode is indicated by the blank triangle play symbol (▷).
When you use the property definition from the APL cheat sheets, you can add a schema-compliant VectorGraphic
component to your APL document without needing to remember or look up details from the APL documentation. The following code example shows the schema-compliant VectorGraphic
component.
{
"type": "VectorGraphic",
"scale": "best-fit",
"align": "left",
"source": "https://my.server/my-avg-graphic-source.json",
"onFail": [
{
"type": "SetValue",
"property": "source",
"value": "https://my.server/my-avg-graphic-fallback.json"
}
]
}
Last updated: Mar 21, 2024