APL for Screen Devices Reference
With Alexa Presentation Language (APL), you can create visual experiences to accompany your skill. You can include animations, graphics, images, slideshows, and video in your visual experience. You use the APL
document format to build these experiences.
See the following sections for an overview of the available APL reference materials.
Documents and packages
An 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 layouts across different APL documents.
See the following topics for details about the APL document format and the top-level properties within a document.
Styles
An APL style defines a set of visual properties. Apply the style to a component to consistently set those properties on the component. Styles can include conditional logic and can use component state. For example, a style could change text color depending on whether the state for the component is checked
.
See the following topics for details about defining and using styles:
Data sources and data binding
APL supports data-binding, which lets your document retrieve data from a separate data source that you provide. Data binding lets you separate your presentation logic (the APL document) from your source data.
See the following topics for details about defining data sources and using data binding:
- Data Sources
- Transformers
- Data-Binding Evaluation
- Data-Binding Syntax
- Viewport Object in the Data-binding Context
Components
An APL component is a primitive UI element that displays on the viewport, such as a text box. Components are the basic building blocks for constructing a document.
- All components have the same Base Component Properties.
- Components that receive input from tap, cursor, or keyboard events have the Actionable Component Properties.
- Components that receive input from tap or pointer events have the Touchable Component Properties
- Components that can render multiple child components have the Multiple Child Component Properties.
For a list of available components, see: Components.
Commands
An APL command sends a message to the APL document. You can use commands to change the visual experience during runtime and to communicate with your skill service during the interaction.
You can run commands directly from event handlers in the APL document, and your skill can send commands to the device with the Alexa.Presentation.APL.ExecuteCommands directive.
See the following topics for details about commands:
Filters
An APL filter applies visual effects to images. For details about filters, see Filters.
Vector graphics format
The Alexa Vector Graphics (AVG) format defines vector graphics you can use in your APL documents. You can then display an AVG with the VectorGraphic
component.
For details about AVG, see Alexa Vector Graphics Format.
Keyboard handlers
APL provides support for keyboard events. You can define keyboard handlers to capture and respond to key presses. For details, see Keyboard Events and Handlers.
Tick event handlers
A tick event handler runs a set of commands as time passes. For example, you can use a tick handler to animate filling in a progress bar every few seconds. For details about tick events and tick handlers, see Tick Event Handlers.
Gestures
APL supports gestures, such as dragging a component, swiping to delete an item, and performing long-press on the screen. For details about the gesture handlers you can define to capture these events and run commands, see Gestures.
Extensions
Extensions are optional enhancements to an APL runtime that provide additional sources of data, commands, and event handlers. For details about extensions, see Extensions.
Related topics
Last updated: Nov 28, 2023