Card
The Alexa card responsive component AlexaCard
displays an atomic unit of content within a container. Use this component for a glanceable, digestible snapshot of information. You can configure the background, the metadata, and the command to run when the user selects the card.
Compatibility
AlexaCard
is designed to work with the following standard viewport profiles in the alexa-viewport-profiles
package:
- All hub landscape profiles
- All hub portrait profiles
- All TV profiles
If you use AlexaCard
on an unsupported viewport, you might have unexpected results. For details about viewport profiles, see Viewport Profiles.
Import the alexa-layouts package
To use AlexaCard
, import the alexa-layouts package.
The latest version of the alexa-layouts
package is 1.7.0. AlexaCard
was introduced in version 1.7.0.
The AlexaCard
component can display icons next to the secondaryText
and tertiaryText
. To use an icon from the Alexa Icon Library, you must also import the alexa-icon
package into your document. The following example shows an import
array that imports the latest versions of alexa-layouts
and alexa-icon
.
{
"import": [
{
"name": "alexa-layouts",
"version": "1.7.0"
},
{
"name": "alexa-icon",
"version": "1.0.0"
}
]
}
AlexaCard parameters
The following table shows the parameters you can set on AlexaCard
. Unless otherwise noted, standard viewport profiles support all parameters. 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 |
---|---|---|---|---|---|
|
String |
|
A string describing the card. Voice over reads this string when the user selects the card. |
Not supported |
1.7.0 |
|
String |
— |
URL for attribution image source. |
Not supported |
1.7.0 |
|
— |
Background color for the card. |
Not supported |
1.7.0 | |
|
String |
|
Unique identifier for this instance of the |
Not supported |
1.7.0 |
|
Boolean |
|
When |
Not supported |
1.7.0 |
|
Boolean |
|
When |
Not supported |
1.7.0 |
|
Boolean |
|
When |
Not supported |
1.7.0 |
|
Any |
— |
The graphic to display to represent an 'empty' rating slot (such as an empty star). Used when |
Not supported |
1.7.0 |
|
Any |
— |
Array of entity data bind to this layout |
Not supported |
1.7.0 |
|
Any |
— |
The graphic to display to represent a 'full' rating slot (such as a full star). Used when |
Not supported |
1.7.0 |
|
Any |
— |
The graphic to display to represent a 'half' rating slot (such as a half star). Used when |
Not supported |
1.7.0 |
|
String |
— |
Header text to display at the top of the card. |
Not supported |
1.7.0 |
|
String |
— |
Alt text for the image. Voice over reads this string. |
Not supported |
1.7.0 |
|
Boolean |
|
When |
Not supported |
1.7.0 |
|
Boolean |
|
When |
Not supported |
1.7.0 |
|
Number |
0 |
When set to a number from 1 to 100, display a progress bar on the image based on the provided percentage. This gives the user a glanceable status for the item. The progress bar displays when |
Not supported |
1.7.0 |
|
Boolean |
|
When |
Not supported |
1.7.0 |
|
String |
— |
URI for the image to display. |
Not supported |
1.7.0 |
|
Array of commands |
— |
The action to trigger when the user taps the card. |
Not supported |
1.7.0 |
|
String |
— |
Primary text to display. |
Not supported |
1.7.0 |
|
String |
AVG |
The type of graphic to use for the rating. Set to |
Not supported |
1.7.0 |
|
Number |
— |
A numeric rating between 0 and 5. When set to a positive number, displays the number as a star rating. Set to a negative number or omit to leave off the rating. |
Not supported |
1.7.0 |
|
String |
multiple |
Determines whether to display a single graphical asset for the rating, or build the rating from multiple image assets. When set to |
Not supported |
1.7.0 |
|
String |
— |
Text to display next to the rating. Ignored when |
Not supported |
1.7.0 |
|
String |
— |
Secondary icon name. Set to the name of an icon in the Alexa Icon Library. You must also import the |
Not supported |
1.7.0 |
|
String |
— |
URL of an AVG to display as the secondary icon. Used when |
Not supported |
1.7.0 |
|
String |
— |
Secondary text to display. |
Not supported |
1.7.0 |
|
Any |
— |
The graphic to display to represent the rating. Used when |
Not supported |
1.7.0 |
|
— |
The width of the bounding box for the single graphic that represents the rating. Used when |
Not supported |
1.7.0 | |
|
String |
— |
Tertiary icon name. Set to the name of an icon in the Alexa Icon Library. You must also import the |
Not supported |
1.7.0 |
|
String |
— |
URL of an AVG to display as the tertiary icon. Used when |
Not supported |
1.7.0 |
|
String |
— |
Tertiary text to display. |
Not supported |
1.7.0 |
|
String |
|
Set the dark or light color theme. The selected theme controls the colors used for the component. |
Not supported |
1.7.0 |
|
String |
— |
Always set to |
Not supported |
1.7.0 |
AlexaCard example
The following example shows AlexaCard
displayed within a horizontal Sequence
component. When you tap a card, the header updates to show the ID of the card you tapped and Alexa sends a UserEvent
with this information to the skill. To test the SendEvent
command, copy this example to a skill.
Related topics
Last updated: Nov 28, 2023