Documents and Packages


An Alexa Presentation Language (APL) document is a JSON object that defines a template to display on a device with a screen. An APL package is an APL document containing reusable layouts and other resources that you can import into your document. Using a package lets you share components across different APL documents.

See the topics in this section for details about the APL document format and the top-level properties within a document.

Document

An APL document controls the structure and layout of the content to display on the screen. You send the document to the device with the Alexa.Presentation.APL.RenderDocument directive.

For details about the JSON format for an APL document, see Document.

Package

An APL package is a container for layouts, resources, and styles that you can import into your APL documents. For more about packages, see Package.

Resources

A resource is a named constant you can use instead of hardcoding values in your document. For example, you could create a resource called myRed that defines a particular shade of red, and then use that resource name to specify a color for different components. You can define resources conditionally, which is useful when designing responsive documents that work on different devices.

For details about defining and using resources, see Resources.

Layouts

An APL layout combines components into a reusable template and gives it a name. You can then place the layout in your document by referencing its name. Using layouts results in a more modular design that's easier to maintain.

For details about creating and using layouts, see Layouts.

Conditional component inflation

Conditional component inflation determines which components and layouts to inflate (render) in an APL document. For example, the mainTemplate property of an APL document accepts an array of components in the items property, but renders a single component. Conditional component inflation determines which one to inflate.

For details about how APL determines the components to render, see Conditional Component Inflation.

Data Types

APL supports a set of data types, which you use when setting property values in your APL document. For a reference to the available data types, see Data Types.


Was this page helpful?

Last updated: Nov 28, 2023