Skip to content

Overview


Logo

ms-adaptive-cards

Implements Microsoft Adaptive Cards models to generate json data from Python.

Report Bug ยท Request Feature

CI PyPi Contributors Forks Stargazers Issues MIT License


Adaptive Cards are an open card exchange format enabling developers to exchange UI content in a common and consistent way.

Card Authors describe their content as a simple JSON object. That content can then be rendered natively inside a Host Application, automatically adapting to the look and feel of the Host.

Goals

The goals for Adaptive Cards are:

  • Portable - To any app, device, and UI framework
  • Open - Libraries and schema are open source and shared
  • Low cost - Easy to define, easy to consume
  • Expressive - Targeted at the long tail of content that developers want to produce
  • Purely declarative - No code is needed or allowed
  • Automatically styled - To the Host application UX and brand guidelines

Example

from msadaptivecards.cards import AdaptiveCard
from msadaptivecards.elements import TextBlock


adaptive_card = AdaptiveCard()

text_block = TextBlock(text="Hello World")

adaptive_card.body.append(text_block)

json = adaptive_card.json(by_alias=True, exclude_none=True)

Last update: 2022-08-16