Training
Learning path
Use advance techniques in canvas apps to perform custom updates and optimization - Training
Use advance techniques in canvas apps to perform custom updates and optimization
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
The following specification describes how implement an Adaptive Card renderer on any native UI platform.
Important
This content is a work in progress and may be missing some details. Please let us know if you have any questions or feedback.
speak
property MAY contain SSML markup and MUST be returned to the host app as-specifiedAdaptiveCard
constructor MUST give the version
property a default value based on the current schema versionversion
property in the AdaptiveCard
that is higher than the supported version, it MUST return the fallbackText
instead.An AdaptiveCard
consists of a body
and actions
. The body
is a collection of CardElement
s that a renderer will enumerate and render in order.
display: block
in HTML).wrap
property is true
.TextBlock
.TextBlock
allows DATE/TIME formatting functions that MUST be supported on every renderer.maxImageSize
param when downloading HTTP images.png
and .jpeg
.gif
imagesThe Renderer MUST take care to the following behaviors when rendering card elements with respect to the attributes mentioned in this doc.
The renderer should manage Constraints taking into account the various factors such as margin, padding, height and width etc configuration of the card elements and its children.
auto
, stretch
and fixed values in terms of pixels
and weight
auto
provides sufficient space for expansion of width (supports min expansion)stretch
takes up the remaining width (supports max expansion)Below below scenarios describes how the constraints are affected with different width combinations for columns
auto
and stretch
width.auto
width takes sufficient space to display the content and the second column with stretch
width takes up the entire space.stretch
widthauto
,stretch
and auto
The first and third columns width is adjusted first to accommodate the elements sufficiently and the second column with stretched width takes up the remaining space.
auto
width columnsauto
will position themselves to provide ample space for the content to render.stretch
and auto
image size, but not for fixed width and height in pixels.weight
and pixel
width combinationColumn1: Weight 50
, Column2: 100px
, Column3: Weight 50
pixel value
weights
and the calculated weight ratio
.weight
, pixel width
and auto
attributesColumn1: Weight 50
, Column2: 100px
, Column3: Weight 50
, and Column4: auto
auto
width column downscales to adjust to the remaining space.px
> weight
> auto
> stretch
Allowed values - auto
and stretch
Below scenarios describes how the constraints are affected with different height combinations for card elements
auto
and stretch
valueswrap
property disabled for the text block.wrap
property enabled for the text block.spacing
property on every element influences the amount of space between the CURRENT element and the one BEFORE it.hostConfig
spacing for the enum value applied to the current element.separator
value of true
, then a visible line MUST be drawn between the current element and the one before it.container.style.default.foregroundColor
.none
, small
, default
, medium
, large
, extra large
and padding
[Note. Need to confirm the distance where the seperator is inserted in the spacing area. Seems like the middle]
none
, default
, emphasis
, good
, attention
, warning
and accent
[Note. Need to check how the padding amount is determined. Is it determined by the host? ]
on
and off
.auto
, stretch
, small
, medium
, large
auto
: Images will scale down to fit if needed, but will not scale up to fill the area.stretch
: Image with both scale down and up to fit as needed.small
, medium
and large
: Image is displayed with a fixed width, where the width is determined by the host.auto
vs stretch
stretch
width allow images to upscale freely with stretch
size.auto
width allows image to occupy exact space irrespective of auto
and stretch
size of image.size
property is overriden when a value is specifiedauto
width will have more precedence than stretch
in providing room for image content in this arrangement.auto
size takes sufficient space for expansion (or downscales) within the column constraints of weight
and pixel
width.stretch
size can expand to fill the remaining space within the constraints of column weight
and pixel
width.px
> weight
> auto
> stretch
size
(auto, stretch) is ignored when Image width
and height
in px is provided.stretch
size attribute will upscale the image only when there is remaining space and column auto is not auto
.Spacing
attribute will not have any effect when its the first or the only element among its sibling.supportsInteractivity
is false
, a renderer MUST NOT render any actions.actions
property MUST be rendered as buttons in some kind of action bar, usually at the bottom of the card.AdaptiveCard
which was executedAction | Behavior |
---|---|
Action.OpenUrl | Open an external URL for viewing |
Action.ShowCard | Requests a sub-card to be shown to the user. |
Action.Submit | Ask for all of the input elements to be gathered up into an object which is then sent to you through some method defined by the host application. |
Action.Execute | (Introduced in v1.4) Ask for all of the input elements to be gathered up into an object which is then sent to you through the "universal action pipeline" |
Action.OpenUrl
SHOULD open a URL using the native platform mechanismAction.ShowCard
MUST be supported in some way, based on the hostConfig setting. There are two modes: inline, and popup. Inline cards SHOULD toggle the card visibility automatically. In popup mode, an event SHOULD be fired to the host app to show the card in some way.Action.Submit
element gathers input fields, merges with optional data field, and sends an event to the client.The Submit Action behaves like an HTML form submit, except that where HTML typically triggers an HTTP post, Adaptive Cards leaves it up to each host app to determine what "submit" means to them.
data
property MUST be included in the callback payload.Action.Submit
, a renderer MUST gather all inputs on the card and retrieve their values.1.x Renderer
- The inputs are collected from all fields irrespective of the where in the hierarchy the input field is present.2.x Renderer
- The inputs are collected from fields present in parent container or as a sibling of the Action.Submit
element.Action.Execute was introduced in version 1.4. We will provide implementation guidance for SDKs at a later date. Please reach out if you have questions on this topic.
supportedInteractivity
is false
then a selectAction
MUST NOT render as a touch target.Image
, ColumnSet
, and Column
offer a selectAction
property, which SHOULD be executed when the user invokes it, e.g., by tapping the element.supportsInteractivity
is false
a renderer MUST NOT render any inputs.Input.Date
would ideally offer a date picker to a user, but if this isn't possible on your UI stack, then the renderer MUST fall back to rendering a standard text box.placeholderText
if possibleEach SDK should provide a certain level of flexibilty to Host Apps in order to control the overall styling, and extend the schema as they see fit.
HostConfig
is a shared configuration object that specifies how an Adaptive Card Renderer generates UI.
This allows properties which are platform agnostic to be shared among renderers on different platforms and devices. It also allows tooling to be created which gives you an idea of the look and feel that card would have for a given environment.
TextBlock
rendering with their own logic.Rating
elementAction.Submit
if they don't want it supported.Training
Learning path
Use advance techniques in canvas apps to perform custom updates and optimization - Training
Use advance techniques in canvas apps to perform custom updates and optimization