Skip to main content

Cards and UI Components

The Chat SDK provides a unified API for creating rich cards that automatically convert to platform-specific formats:
  • Slack: Block Kit
  • Microsoft Teams: Adaptive Cards
  • Google Chat: Card v2
You can use either JSX syntax or function calls to build cards.

JSX Syntax

To use JSX, configure your tsconfig.json:
tsconfig.json
Then create cards with JSX:

Function API

Prefer function calls? Same result:

Available Components

Card

The root container for all card content.
Example:

Text

Display text content with optional styling.
Example:
Use CardText instead of Text if you need to avoid conflicts with the global DOM Text constructor.

Image

Embed images in your cards.
Example:

Divider

A visual separator between sections.

Section

Group related content together.

Fields

Display key-value pairs in a multi-column layout.
Example:

Table

Display structured data in a table format.
Example:
Inline hyperlink element.

Complete Example

Here’s a comprehensive card showcasing multiple components:

Fallback Text

Cards automatically generate plain text fallbacks for platforms or clients that can’t render rich cards:

React Integration

If you’re using React components, convert them to card elements:

Next Steps

Actions

Add interactive buttons and handle clicks

Modals

Create forms and dialog workflows