Skip to content
Block Kit for React
Esc
↑↓navigate↵open⌘Jpreview
On this page

Rich text input element

A formatted text field, with Slack's formatting toolbar, that reports a rich_text value.

rich_text_input collects text and hands it back as a rich_text block, the same structure Slack uses for a message composed in its own WYSIWYG editor. It’s an input-block-only element: it doesn’t appear in an actions block or as a section accessory, and, like file_input, Slack only supports it in modals, not Home tabs.

New entry

Summary

Fields

PropType
type"rich_text_input"

Always rich_text_input.

Type"rich_text_input"
action_id?string

Identifies this action in the interaction payload and as the key in state.values. Maximum length is 255 characters.

Typestring
initial_value?RichTextBlock

The rich_text content shown when the surface loads.

TypeRichTextBlock
placeholder?PlainTextElement

Grey placeholder text shown when the field is empty. Maximum length is 150 characters. Without one, the field shows Slack's own, "Write something".

TypePlainTextElement
min_lines?number

The minimum number of lines shown. Must be between 1 and 100.

Typenumber
max_lines?number

The maximum number of lines shown before the field scrolls. Must be between 1 and 100.

Typenumber
Default8
dispatch_action_config?DispatchActionConfig

When the field sends a block_actions payload (with the input block's dispatch_action): on_enter_pressed, the default, or on_character_entered, once typing pauses.

TypeDispatchActionConfig
focus_on_load?boolean

Focuses this field when the surface loads. Only one element per view can set this.

Typeboolean
Defaultfalse

Examples

With an initial value

Your AppAPP
Release notes

Fixed the login redirect loop in auth.ts.

  • Sessions survive a refresh

initial_value takes a full rich_text block, the same shape you’d get back from the element itself, not a plain string. The field draws it as Slack’s editor does: bold, italic, strikethrough, inline code and links styled, each line of a section on its own line, and lists, quotes and code blocks as blocks of their own.

Sizing the field

Your AppAPP
Bio

min_lines sets the field’s starting height; max_lines (8 by default) caps how tall it grows before it scrolls. While text runs past the field, a hairline divides it from the footer, as in Slack.

Interactivity

In an input block with dispatch_action: true, the field calls onAction with its content wrapped as a rich_text block, under rich_text_value, on the trigger in dispatch_action_config: Enter by default (Shift+Enter adds a line), or on_character_entered, once typing pauses for 300ms. Without dispatch_action, typing only updates state.values, as in Slack:

{
  "type": "rich_text_input",
  "action_id": "notes_input",
  "block_id": "notes",
  "action_ts": "1706000000.000100",
  "rich_text_value": {
    "type": "rich_text",
    "elements": [
      {
        "type": "rich_text_section",
        "elements": [{ "type": "text", "text": "Fixed the login redirect loop." }]
      }
    ]
  }
}

Reading the value

Every edit (and the initial value, if any) is written to state.values as { type, rich_text_value }. An edited value keeps its formatting, lists, quotes and code blocks, and joins its lines with \n into one section:

{
  "notes": {
    "notes_input": {
      "type": "rich_text_input",
      "rich_text_value": {
        "type": "rich_text",
        "elements": [
          {
            "type": "rich_text_section",
            "elements": [{ "type": "text", "text": "Fixed the login redirect loop." }]
          }
        ]
      }
    }
  }
}

Last updated on