Skip to main content

Rich Text

Inline and layout factories for Slack rich-text blocks.

Build inline elements first, combine them in a section, list, quote, or code block, then pass those layout objects to richTextBlock.

richText()

richText(text, style?, settings?): SlackObject<"text">

Creates a styled rich-text text run.

Parameters

ParameterTypeDescription
textstringText content.
style?RichTextStyleOptional inline formatting.
settings?FactorySettingsPer-call validation settings.

Returns

SlackObject<"text">

A validated Slack rich-text text element.


richTextChannel()

richTextChannel(channelId, style?, settings?): SlackObject<"channel">

Creates a rich-text channel mention.

Parameters

ParameterTypeDescription
channelIdstringSlack channel identifier.
style?RichTextStyleOptional inline formatting.
settings?FactorySettingsPer-call validation settings.

Returns

SlackObject<"channel">

A validated Slack rich-text channel element.


richTextCodeBlock()

richTextCodeBlock(elements, options?, settings?): SlackObject<"rich_text_preformatted">

Creates a preformatted rich-text code block.

Input fields

Optional border thickness.

Input fieldTypeDescription
border?numberOptional border thickness.

Settings

SettingTypeDescription
elementsJsonObject[]Inline rich-text elements displayed as code.
settingsFactorySettingsPer-call validation settings.

Returns

SlackObject<"rich_text_preformatted">

A validated Slack rich_text_preformatted object.


richTextEmoji()

richTextEmoji(name, settings?): SlackObject<"emoji">

Creates a rich-text emoji.

Parameters

ParameterTypeDescription
namestringEmoji name without surrounding colons.
settingsFactorySettingsPer-call validation settings.

Returns

SlackObject<"emoji">

A validated Slack rich-text emoji element.


richTextLink(input, settings?): SlackObject<"link">

Creates a rich-text link.

Input fields

Destination URL, optional label, safety flag, and formatting.

Input fieldTypeDescription
style?RichTextStyleOptional inline formatting.
text?stringOptional visible label. Slack displays the URL when omitted.
unsafe?booleanMark a URL as unsafe when mirroring a Slack-provided payload.
urlstringDestination URL.

Settings

SettingTypeDescription
settingsFactorySettingsPer-call validation settings.

Returns

SlackObject<"link">

A validated Slack rich-text link element.


richTextList()

richTextList(input, settings?): SlackObject<"rich_text_list">

Creates an ordered or bulleted rich-text list.

Input fields

List items, marker style, and optional list layout.

Input fieldTypeDescription
border?numberOptional border thickness.
elementsJsonObject[]Rich-text section objects used as list items.
indent?numberNesting depth.
offset?numberStarting number for an ordered list.
style"bullet" | "ordered"List marker style.

Settings

SettingTypeDescription
settingsFactorySettingsPer-call validation settings.

Returns

SlackObject<"rich_text_list">

A validated Slack rich_text_list object.

Throws

MissingRequiredError when style is not provided.


richTextQuote()

richTextQuote(elements, options?, settings?): SlackObject<"rich_text_quote">

Creates a rich-text block quote.

Input fields

Optional border thickness.

Input fieldTypeDescription
border?numberOptional border thickness.

Settings

SettingTypeDescription
elementsJsonObject[]Inline rich-text elements displayed in the quote.
settingsFactorySettingsPer-call validation settings.

Returns

SlackObject<"rich_text_quote">

A validated Slack rich_text_quote object.


richTextSection()

richTextSection(elements, settings?): SlackObject<"rich_text_section">

Creates a paragraph-like rich-text section.

Parameters

ParameterTypeDescription
elementsJsonObject[]Inline rich-text elements in display order.
settingsFactorySettingsPer-call validation settings.

Returns

SlackObject<"rich_text_section">

A validated Slack rich_text_section object.


RichTextStyle

Inline formatting supported by rich-text text, links, users, and channels.

Properties

PropertyTypeDescription
bold?booleanRender the inline content in bold.
code?booleanRender the inline content as code.
italic?booleanRender the inline content in italics.
strike?booleanRender the inline content with a strikethrough.

richTextUser()

richTextUser(userId, style?, settings?): SlackObject<"user">

Creates a rich-text user mention.

Parameters

ParameterTypeDescription
userIdstringSlack user identifier.
style?RichTextStyleOptional inline formatting.
settings?FactorySettingsPer-call validation settings.

Returns

SlackObject<"user">

A validated Slack rich-text user element.


richTextUserGroup()

richTextUserGroup(usergroupId, style?, settings?): SlackObject<"usergroup">

Creates a rich-text user-group mention.

Parameters

ParameterTypeDescription
usergroupIdstringSlack user-group identifier.
style?RichTextStyleOptional inline formatting.
settings?FactorySettingsPer-call validation settings.

Returns

SlackObject<"usergroup">

A validated Slack rich-text usergroup element.