@microsoft/teams.cards
Version:
<p> <a href="https://www.npmjs.com/package/@microsoft/teams.cards" target="_blank"> <img src="https://img.shields.io/npm/v/@microsoft/teams.cards" /> </a> <a href="https://www.npmjs.com/package/@microsoft/teams.cards?activeTab=code" ta
95 lines (92 loc) • 1.79 kB
JavaScript
'use strict';
var base = require('../base');
class TextBlock extends base.Element {
type;
/**
* Text to display. A subset of markdown is supported (https://aka.ms/ACTextFeatures)
*/
text;
/**
* The style of this TextBlock for accessibility purposes.
*/
style;
/**
* Controls the color of TextBlock elements.
*/
color;
/**
* Type of font to use for rendering
*/
fontType;
/**
* If true, displays text slightly toned down to appear less prominent.
*/
isSubtle;
/**
* Specifies the maximum number of lines to display.
*/
maxLines;
/**
* Controls size of text.
*/
size;
/**
* Controls the weight of TextBlock elements.
*/
weight;
/**
* If true, allow text to wrap. Otherwise, text is clipped.
*/
wrap;
constructor(text, options = {}) {
super();
this.type = "TextBlock";
this.text = text;
Object.assign(this, options);
}
static from(options) {
return new TextBlock(options.text, options);
}
withStyle(value) {
this.style = value;
return this;
}
withColor(value) {
this.color = value;
return this;
}
withFontType(value) {
this.fontType = value;
return this;
}
withSubtle(value = true) {
this.isSubtle = value;
return this;
}
withMaxLines(value) {
this.maxLines = value;
return this;
}
withSize(value) {
this.size = value;
return this;
}
withWeight(value) {
this.weight = value;
return this;
}
withWrap(value = true) {
this.wrap = value;
return this;
}
addText(...value) {
this.text += value.join("");
return this;
}
toString() {
return this.text;
}
}
exports.TextBlock = TextBlock;
//# sourceMappingURL=text-block.js.map
//# sourceMappingURL=text-block.js.map