You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/documentation/docs/controls/AdaptiveCardHost.md
+29-11Lines changed: 29 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,18 @@ Three custom themes have been created for Microsoft Teams to emulate the colors
11
11
12
12
All Elements and Actions of Adaptive Cards have been redefined using Fluent UI React, both for SharePoint and Microsoft Teams (in this case the "Fluent UI Northstar" library is not used), adding and improving features that are not managed in Microsoft's implementation of the "adaptivecards-fluentui" library (Theme support for example).
13
13
14
+
Thanks to the "context" property that allows you to pass the SPFx context, whether the "data" property is passed or not, a new field called @context will be injected into the data object.
15
+
16
+
This allows, using Adaptive Cards templating syntax, to access to the context informations using the following fields (for more information on these fields, refer to the [BaseComponentContext](https://docs.microsoft.com/en-us/javascript/api/sp-component-base/basecomponentcontext) class):
17
+
- "theme": property "theme" from the current theme applied to the card.
18
+
- "aadInfo": Azure AD informations retrieved from the SPFx context object.
19
+
- "cultureInfo": Culture informations retrieved from the SPFx context object.
20
+
- "userInfo": User informations retrieved from the SPFx context object.
21
+
- "spListInfo": Current List informations retrieved from the SPFx context object.
22
+
- "spListItemInfo": Current List item informations retrieved from the SPFx context object.
23
+
- "spSiteInfo": Current Site informations retrieved from the SPFx context object.
24
+
- "spWebInfo": Current Web informations retrieved from the SPFx context object.
25
+
14
26
The Adaptive Cards version supported is 1.5, by using the 'adaptivecards' npm package version 2.10.0.
15
27
16
28
Here is an example of the control in action inside a Web Part:
@@ -27,22 +39,23 @@ Here is an example of the previous Web Part (using different Card), hosted as a
27
39
- In your component file, import the `AdaptiveCardHost` control as follows:
- Example on use the `AdaptiveCardHost` control with SharePoint Theme "Section Variation" ('this.props.theme' is the theme that come from the Web Part) */):
@@ -132,15 +150,15 @@ The `AdaptiveCardHost` control can be configured with the following properties:
132
150
| data | { "$root": object } | no | Set Data Source for template rendering. |
133
151
| style | React.CSSProperties | no | Set CSS Style. |
134
152
| className | string | no | Set CSS Class. |
135
-
| theme | IPartialTheme or ITheme | no | Set Fluent UI Theme. Used only if the "themeType" property is set to 'ThemeType.SharePoint'. If not set or set to null or not defined, the theme passed through context will be searched, or the default theme of the page will be loaded. |
153
+
| theme | IPartialTheme or ITheme | no | Set Fluent UI Theme. Used only if the "themeType" property is set to 'ThemeType.SharePoint'. If not set or set to null or not defined, the theme passed through context will be searched, or the default theme of the page will be loaded. However, the Theme object will be automatically injected into the data object, so that it can be used by the Adaptive Cards binding engine.|
136
154
| themeType | ThemeType | no | Select the Type of Theme you want to use. If it is not set or set to null or undefined, the 'ThemeType.SharePoint' value will be used and the "theme" property or the theme passed through the context or default page will be loaded. In other cases, the chosen Microsoft Teams theme will be applied. |
137
155
| hostConfig | object | no | Set custom HostConfig. |
138
156
| onInvokeAction | (action: IAdaptiveCardActionResult) => void | yes | Invoked every time an Action is performed. |
139
157
| onError | (error: Error) => void | yes | Invoked every time an exception occurs in the rendering phase. |
140
158
| onSetCustomElements | (registry: CardObjectRegistry<CardElement>) => void | no | Invoked to manage Elements to the current Adaptive Card instance. |
141
159
| onSetCustomActions | (registry: CardObjectRegistry<Action>) => void | no | Invoked to manage Actions to the current Adaptive Card instance. |
142
160
| onUpdateHostCapabilities | (hostCapabilities: HostCapabilities) => void | no | Invoked to manage the HostCapabilities object like add custom properties. |
143
-
|isUniqueControlInPage|boolean| no | Set to true if you want to use only one instance of this control per page, false for multiple controls. This affects how CSS variables are set. |
161
+
|context|BaseComponentContext| no | Set the context from the SPFx component. If set, some context properties will be automatically injected into the data object, so they can be used by the Adaptive Cards binding engine. |
0 commit comments