Share via


TextRun class

A block of text inside a RichTextBlock element.

Constructors

TextRun(string, TextRunOptions)

Properties

color

The color of the text.

fallback

An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property.

fontType

The type of font to use for rendering.

grid.area

The area of a Layout.AreaGrid layout in which an element should be displayed.

highlight

Controls if the text should be highlighted.

id

A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot.

isSortKey

Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements.

isSubtle

Controls whether the text should be renderer using a subtler variant of the select color.

isVisible

Controls the visibility of the element.

italic

Controls if the text should be italicized.

lang

The locale associated with the element.

selectAction

An Action that will be invoked when the text is tapped or clicked. Action.ShowCard is not supported.

size

The size of the text.

strikethrough

Controls if the text should be struck through.

text

The text to display. A subset of markdown is supported.

type

Must be TextRun.

underline

Controls if the text should be underlined.

weight

The weight of the text.

Methods

from(Omit<ITextRun, "type">)
withColor(TextColor)
withFallback(FallbackElement)
withFontType(FontType)
withHighlight(boolean)
withId(string)
withIsSortKey(boolean)
withIsSubtle(boolean)
withIsVisible(boolean)
withItalic(boolean)
withLang(string)
withSelectAction(IExecuteAction | IOpenUrlAction | IResetInputsAction | ISubmitAction | IToggleVisibilityAction)
withSize(TextSize)
withStrikethrough(boolean)
withText(string)
withUnderline(boolean)
withWeight(TextWeight)

Constructor Details

TextRun(string, TextRunOptions)

new TextRun(text: string, options?: TextRunOptions)

Parameters

text

string

options
TextRunOptions

Property Details

color

The color of the text.

color?: TextColor

Property Value

fallback

An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property.

fallback?: FallbackElement

Property Value

fontType

The type of font to use for rendering.

fontType?: FontType

Property Value

grid.area

The area of a Layout.AreaGrid layout in which an element should be displayed.

grid.area?: string

Property Value

string

highlight

Controls if the text should be highlighted.

highlight?: boolean

Property Value

boolean

id

A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot.

id?: string

Property Value

string

isSortKey

Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements.

isSortKey?: boolean

Property Value

boolean

isSubtle

Controls whether the text should be renderer using a subtler variant of the select color.

isSubtle?: boolean

Property Value

boolean

isVisible

Controls the visibility of the element.

isVisible?: boolean

Property Value

boolean

italic

Controls if the text should be italicized.

italic?: boolean

Property Value

boolean

lang

The locale associated with the element.

lang?: string

Property Value

string

selectAction

An Action that will be invoked when the text is tapped or clicked. Action.ShowCard is not supported.

selectAction?: IExecuteAction | IOpenUrlAction | IResetInputsAction | ISubmitAction | IToggleVisibilityAction

Property Value

size

The size of the text.

size?: TextSize

Property Value

strikethrough

Controls if the text should be struck through.

strikethrough?: boolean

Property Value

boolean

text

The text to display. A subset of markdown is supported.

text: string

Property Value

string

type

Must be TextRun.

type: "TextRun" = "TextRun"

Property Value

"TextRun"

underline

Controls if the text should be underlined.

underline?: boolean

Property Value

boolean

weight

The weight of the text.

weight?: TextWeight

Property Value

Method Details

from(Omit<ITextRun, "type">)

static function from(options: Omit<ITextRun, "type">): TextRun

Parameters

options

Omit<ITextRun, "type">

Returns

withColor(TextColor)

function withColor(color: TextColor): TextRun

Parameters

color
TextColor

Returns

withFallback(FallbackElement)

function withFallback(fallback: FallbackElement): TextRun

Parameters

fallback
FallbackElement

Returns

withFontType(FontType)

function withFontType(fontType: FontType): TextRun

Parameters

fontType
FontType

Returns

withHighlight(boolean)

function withHighlight(highlight?: boolean): TextRun

Parameters

highlight

boolean

Returns

withId(string)

function withId(id: string): TextRun

Parameters

id

string

Returns

withIsSortKey(boolean)

function withIsSortKey(isSortKey?: boolean): TextRun

Parameters

isSortKey

boolean

Returns

withIsSubtle(boolean)

function withIsSubtle(isSubtle: boolean): TextRun

Parameters

isSubtle

boolean

Returns

withIsVisible(boolean)

function withIsVisible(isVisible?: boolean): TextRun

Parameters

isVisible

boolean

Returns

withItalic(boolean)

function withItalic(italic?: boolean): TextRun

Parameters

italic

boolean

Returns

withLang(string)

function withLang(lang: string): TextRun

Parameters

lang

string

Returns

withSelectAction(IExecuteAction | IOpenUrlAction | IResetInputsAction | ISubmitAction | IToggleVisibilityAction)

function withSelectAction(selectAction: IExecuteAction | IOpenUrlAction | IResetInputsAction | ISubmitAction | IToggleVisibilityAction): TextRun

Parameters

Returns

withSize(TextSize)

function withSize(size: TextSize): TextRun

Parameters

size
TextSize

Returns

withStrikethrough(boolean)

function withStrikethrough(strikethrough?: boolean): TextRun

Parameters

strikethrough

boolean

Returns

withText(string)

function withText(text: string): TextRun

Parameters

text

string

Returns

withUnderline(boolean)

function withUnderline(underline?: boolean): TextRun

Parameters

underline

boolean

Returns

withWeight(TextWeight)

function withWeight(weight: TextWeight): TextRun

Parameters

weight
TextWeight

Returns