Skip to content

feat(types): add min_lines/max_lines to RichTextInput - #2680

Open
srtaalej wants to merge 3 commits into
mainfrom
feat/rich-text-input-min-max-lines
Open

feat(types): add min_lines/max_lines to RichTextInput#2680
srtaalej wants to merge 3 commits into
mainfrom
feat/rich-text-input-min-max-lines

Conversation

@srtaalej

@srtaalej srtaalej commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds optional min_lines and max_lines integer properties to the RichTextInput Block Kit element interface, allowing developers to control the visible height of rich_text_input elements.

  • min_lines — minimum number of visible lines (1–50)
  • max_lines — maximum number of visible lines before scrolling (1–50, defaults to 8 on the platform when unset)

Both properties are optional, preserving full backward compatibility.

Testing

Test app.js
import { App } from '@slack/bolt';

const app = new App({
  token: process.env.SLACK_BOT_TOKEN,
  socketMode: true,
  appToken: process.env.SLACK_APP_TOKEN,
});

app.command('/rich-text-test', async ({ ack, client, body }) => {
  await ack();
  await client.views.open({
    trigger_id: body.trigger_id,
    view: {
      type: 'modal',
      title: { type: 'plain_text', text: 'Rich Text Test' },
      submit: { type: 'plain_text', text: 'Submit' },
      blocks: [
        {
          type: 'input',
          block_id: 'rich_text_block',
          label: { type: 'plain_text', text: 'Default (no min/max — should be 8 max)' },
          element: {
            type: 'rich_text_input',
            action_id: 'default_input',
          },
        },
        {
          type: 'input',
          block_id: 'rich_text_min_block',
          label: { type: 'plain_text', text: 'min_lines: 5' },
          element: {
            type: 'rich_text_input',
            action_id: 'min_input',
            min_lines: 5,
          },
        },
        {
          type: 'input',
          block_id: 'rich_text_max_block',
          label: { type: 'plain_text', text: 'max_lines: 16' },
          element: {
            type: 'rich_text_input',
            action_id: 'max_input',
            max_lines: 16,
          },
        },
        {
          type: 'input',
          block_id: 'rich_text_both_block',
          label: { type: 'plain_text', text: 'min_lines: 3, max_lines: 20' },
          element: {
            type: 'rich_text_input',
            action_id: 'both_input',
            min_lines: 3,
            max_lines: 20,
          },
        },
      ],
    },
  });
});

(async () => {
  await app.start();
  app.logger.info('⚡️ Rich Text Test app is running!');
})();

Requirements

@changeset-bot

changeset-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d2941d3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@slack/types Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@srtaalej srtaalej self-assigned this Jul 28, 2026
@srtaalej srtaalej added enhancement M-T: A feature request for new functionality pkg:types applies to `@slack/types` semver:minor labels Jul 28, 2026
@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.11%. Comparing base (046647f) to head (d2941d3).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2680   +/-   ##
=======================================
  Coverage   89.11%   89.11%           
=======================================
  Files          65       65           
  Lines       10339    10339           
  Branches      471      471           
=======================================
  Hits         9214     9214           
  Misses       1095     1095           
  Partials       30       30           
Flag Coverage Δ
cli-hooks 89.11% <ø> (ø)
cli-test 89.11% <ø> (ø)
logger 89.11% <ø> (ø)
oauth 89.11% <ø> (ø)
socket-mode 89.11% <ø> (ø)
web-api 89.11% <ø> (ø)
webhook 89.11% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@srtaalej
srtaalej marked this pull request as ready for review July 28, 2026 21:21
@srtaalej
srtaalej requested a review from a team as a code owner July 28, 2026 21:21
@srtaalej
srtaalej requested a review from zimeg July 28, 2026 21:21
@zimeg zimeg added this to the types@next milestone Jul 28, 2026

@zimeg zimeg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srtaalej LGTM and thank you for updating these block inputs 📝

I'm approving now with a note that the JSDoc might need updating to match the backend capabilities of the moment. When confident please do feel free to merge this 🚢 💨

*/
initial_value?: RichTextBlock;
/**
* @description The minimum number of lines of text shown in the input. Must be between 1 and 50.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @description The minimum number of lines of text shown in the input. Must be between 1 and 50.
* @description The minimum number of lines of text shown in the input. Must be between 1 and 100.

🔬 question: I find the API docs suggest "100" as a maximum minimum - would this be something to update here or in reference?

The minimum number of visible text lines the input should display before scrolling. Controls the initial height of the input. Must be between 1 and 100.

🔗 https://docs.slack.dev/reference/block-kit/block-elements/rich-text-input-element/

*/
min_lines?: number;
/**
* @description The maximum number of lines of text shown in the input before it scrolls. Must be between 1 and 50.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @description The maximum number of lines of text shown in the input before it scrolls. Must be between 1 and 50.
* @description The maximum number of lines of text shown in the input before it scrolls. Must be between 1 and 100.

🦠 note: Similar suggestion as above!

// RichTextInput — sad paths
expectError<RichTextInput>({
type: 'rich_text_input',
min_lines: '3',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
min_lines: '3',
min_lines: '3', // Minimum should be integer

🧪 suggestion(non-blocking): To make these spec more clear!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌟 praise: Thanks for keeping qualities highest with test! I'm hoping we can organize this file as more coverage is added for other elements ongoing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement M-T: A feature request for new functionality pkg:types applies to `@slack/types` semver:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants