Motion Pager (Widget)
The Alexa motion pager responsive component AlexaMotionPager displays content in a series of pages with a widget-specific animation for changing pages. You use Alexa Presentation Language (APL) components and responsive components or templates to define the pages to show.
Compatibility
AlexaMotionPager is designed to work with the following widget viewport profiles in the alexa-viewport-profiles package:
- Widget Medium (
@hubWidgetMedium)
If you use AlexaMotionPager on an unsupported viewport, you might have unexpected results. For details about viewport profiles, see Viewport Profiles.
Import the alexa-layouts package
To use AlexaMotionPager, import the alexa-layouts package.
The latest version of the alexa-layouts package is 1.7.0. AlexaMotionPager was introduced in version 1.5.0.
AlexaMotionPager parameters
The following table shows the AlexaMotionPager properties that work with the widget viewport profiles. Not all parameters apply to all viewport profiles. The "Widget support" column indicates the widget viewport profiles that support each parameter. For details about viewport profiles, see Viewport Profiles.
All parameters except type are optional.
| Name | Type | Default | Description | Widget support | Version added |
|---|---|---|---|---|---|
|
|
Array |
— |
Data to bind into the |
Medium |
1.5.0 |
|
|
Integer |
0 |
The zero-based index of the starting page to display. |
Medium |
1.5.0 |
|
|
Any |
— |
An array of components or a single component to display. |
Medium |
1.5.0 |
|
|
String |
|
Specifies the allowed navigation direction. Possible values are |
Medium |
1.5.0 |
|
|
Array |
— |
Commands to run when the page changes. These commands run after the pager has fully switched to the new page. |
Medium |
1.5.0 |
|
|
String |
— |
An identifier to use for the underlying |
Medium |
1.5.0 |
|
|
One of: |
|
Specifies the style of the paginations dots displayed. Applies when |
Medium |
1.5.0 |
|
|
Boolean |
|
When |
Medium |
1.5.0 |
|
|
String |
— |
Always set to |
Medium |
1.5.0 |
Define the pages to display
Provide the pages to display in AlexaMotionPager in the items property.
AlexaMotionPager is a multi-child component. Therefore, how the items array works to define pages depends on whether you also set the data property:
- When
datacontains an array of values,AlexaMotionPageruses the data array inflation method. This means that the components initemsare inflated one time for each value indata. -
When
dataisn't set,AlexaMotionPageruses the simple array of child components inflation method. This means that each item in theitemsarray is inflated as a separate page.Note: Thedataproperty doesn't have a default. If you aren't using thedataproperty in theMotionPager, assigndatato an empty array ([])
The AlexaMotionPager component doesn't display any content on its own. You must provide the components or layouts to display in the items property.
Widget-specific animation when changing pages
AlexaMotionPager uses a custom "swipe away" page change animation:
- When the pager advances to the next page, the current page slides out of view and reveals the next page underneath.
- When the pager moves back to the previous page, the new page slides into view and covers the current page.
The following example shows this widget-specific animation. The AlexaMotionPager uses the AlexaTextWrapping responsive template to display text over a background. The AlexaFooterActionButton on the template runs a command to page through all the pages in the pager. After the AutoPage command finishes, the SetPage command resets the widget to the first page.
For a widget pager with an alternative "zoom" page transition, see Motion Scale.
AlexaMotionPager examples
The following example shows an AlexaMotionPager that uses the simple array of child components inflation method to display three pages. The pager displays each component in items as a separate page.
Related topics
Last updated: Dec 12, 2023