fluent-cards
v0.2.0-beta.5
Published
Fluent builder API for Adaptive Cards
Readme
FluentCards — Node.js / TypeScript
A TypeScript library for building Adaptive Cards using a fluent builder pattern with strong typing and built-in validation.
Installation
npm install fluent-cardsQuick Start
import { AdaptiveCardBuilder, TextSize, TextWeight, toJson } from 'fluent-cards';
const card = AdaptiveCardBuilder.create()
.withVersion('1.5')
.addTextBlock(tb => tb
.withText('Hello, FluentCards!')
.withSize(TextSize.Large)
.withWeight(TextWeight.Bolder)
.withWrap(true))
.addAction(a => a
.openUrl('https://adaptivecards.io')
.withTitle('Learn More'))
.build();
console.log(toJson(card));Project Layout
node/
├── fluent-cards/ # Library package
│ ├── src/
│ │ ├── builders/ # Fluent builder classes
│ │ ├── enums.ts # String enums
│ │ ├── models.ts # Interfaces & discriminated unions
│ │ ├── serialization.ts
│ │ ├── validation.ts
│ │ └── index.ts # Barrel export
│ ├── tsconfig.json
│ └── package.json
├── fluent-cards-tests/ # Test suite (node:test + tsx)
│ ├── test/
│ ├── tsconfig.json
│ └── package.json
└── package.json # npm workspace rootAPI Overview
All elements use the builder pattern: create() → withX() / addX(configure) → build().
Available builders: AdaptiveCardBuilder, TextBlockBuilder, ImageBuilder, ContainerBuilder, ColumnSetBuilder, ColumnBuilder, FactSetBuilder, RichTextBlockBuilder, TextRunBuilder, ActionSetBuilder, MediaBuilder, ImageSetBuilder, TableBuilder, ActionBuilder, BackgroundImageBuilder, RefreshBuilder, AuthenticationBuilder, and input builders (InputTextBuilder, InputNumberBuilder, InputDateBuilder, InputTimeBuilder, InputToggleBuilder, InputChoiceSetBuilder).
Build & Test
cd node
npm install
npm test
npm run typecheckSee the root README for more details.
