Getting started - JavaScript

As we described in Getting Started page, an Adaptive Card is a JSON-serialized card object model. This is a JavaScript SDK for generating client-side HTML in the browser.

Important

Breaking changes from v0.5

  1. Package renamed from microsoft-adaptivecards to adaptivecards
  2. The static AdaptiveCards.setHostConfig() has been moved to an instance member of AdaptiveCard. E.g., myCard.hostConfig = {}
  3. HostConfig has gone though various renames and moves. See the sample.json Host Config for current structure
  4. There have also been some schema changes from the v0.5 preview, which are outlined here
  5. The static renderCard() function was removed as it was redundant with the class methods. Use adaptiveCard.render() as described below.

Install

Node

npm install

npm install adaptivecards --save

CDN

<script src="https://unpkg.com/adaptivecards/dist/adaptivecards.js"></script>

Usage

Import the module

// import the module
import * as AdaptiveCards from "adaptivecards";

// or require it
var AdaptiveCards = require("adaptivecards");

// or use the global variable if loaded from CDN
AdaptiveCards.renderCard(...);

Next steps

See Render a card for the next steps!